16.09.2012, 08:46
How to make a set admin level command, but in strcmp ?
if(strcmp(cmd, "/makeadmin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 99998)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strvalEx(tmp);
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("Info: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
}
return 1;
}
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(144) : error 017: undefined symbol "tmp" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(144) : error 017: undefined symbol "idx" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(145) : error 017: undefined symbol "tmp" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(147) : error 035: argument type mismatch (argument 2) C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(152) : error 017: undefined symbol "tmp" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(153) : error 017: undefined symbol "tmp" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(153) : error 017: undefined symbol "idx" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(154) : error 017: undefined symbol "strvalEx" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(159) : error 017: undefined symbol "giveplayer" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(159) : error 017: undefined symbol "giveplayer" C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(159) : error 029: invalid expression, assumed zero C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\reg syst.pwn(159) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 12 Errors.
if(strcmp(cmd, "/makeadmin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 99998)
{
new idx;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level]");
return 1;
}
new para1;
new level;
new tmp[256];
new strvalEx;
new giveplayer[MAX_PLAYER_NAME];
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strvalEx(tmp);
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("Info: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
}
return 1;
}
if(strcmp(cmd, "/makeadmin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 99998)
{
new idx;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level]");
return 1;
}
new para1;
new level;
new tmp[256];
new giveplayer[MAX_PLAYER_NAME];
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("Info: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
}
return 1;
}