Ich wollt mal Fragen ob ich in ein Filterscript einen Befehl rein machen kann, wie:
if(strcmp(cmd, "/setage", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setage [playerid/PartOfName] [age]");
return 1;
}
new playa;
new age;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
age = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 3)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
PlayerInfo[playa][pAge] = age;
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "AdmWarning: %s has set %s's age to %d.", sendername,giveplayer,age);
ABroadCast(COLOR_YELLOW,string,1);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}
Frage! FS
- DominikGLL
- Geschlossen
- Erledigt
-
-
ja, kann man.
-
Wie sehe das denn aus, könntest du das schnell einbauen und mir schicken , wenn das geht?
-
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FFenum pInfo
{
pKey[128],
pAdmin,
pReg,
pCash,
pKills,
pDeaths,
pAge
};new PlayerInfo[MAX_PLAYERS][pInfo];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}#else
#endifpublic OnPlayerCommandText(playerid,cmdtext[])
{
new tmp[256];
new cmd[256];
new idx;
if(strcmp(cmd, "/setage", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setage [playerid/PartOfName] [age]");
return 1;
}
new playa;
new age;
//playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
age = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 3)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new string[128];
new name[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
PlayerInfo[playa][pAge] = age;
GetPlayerName(playa, name, sizeof(name));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "AdmWarning: %s has set %s's age to %d.", sendername,name,age);
ABroadCast(COLOR_YELLOW,string,1);//war bei mir undefiniert ich weiß nicht woher du die funktion hast
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}
return 0;
}strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
} -
Vielen Dank!
Edit: Problem wenn man einloggen will kommt da " you are not authorized!" -
breadfish.de
Hat das Thema geschlossen.