28.10.2012, 14:55
guyz i have a problem with a cmd i made tow cmds 1 /givemark and /showmarks
/givemark works perfect but /showmarks have a prob if i type /showmarks 0
then its show this player got 91 role play marks please help me and fix the /showmarks cmd
here is the code of those cmds
1-/givemark
2-/showmarks
/givemark works perfect but /showmarks have a prob if i type /showmarks 0
then its show this player got 91 role play marks please help me and fix the /showmarks cmd
here is the code of those cmds
1-/givemark
pawn Код:
if(strcmp(cmd, "/givemark", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /givemark [playerid/PartOfName] [amount of marks]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /givemark [playerid/PartOfName] [amount of marks]");
return 1;
}
new amount;
amount = strval(tmp);
if (PlayerInfo[playerid][pTeacher] >= 1)
{
PlayerInfo[giveplayerid][pMarks] = amount;
GetPlayerName(playerid, numewarning, sizeof(numewarning));
format(string, sizeof(string), "[Teacher]: %s Has give you %d Roleplay mark(s).",numewarning,amount,giveplayerid);
ABroadCast(COLOR_LIGHTRED,string, 5);
}
else
{
SCM(playerid, COLOR_RED, " You are not a RolePlay Teacher!");
}
}//not valid id
}//not connected
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/showmarks", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /showmarks [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new amount;
amount = strval(tmp);
PlayerInfo[giveplayerid][pMarks] = amount;
GetPlayerName(playerid, numewarning, sizeof(numewarning));
format(string, sizeof(string), "This Player Has %d Roleplay mark(s).",numewarning,amount,giveplayerid);
ABroadCast(COLOR_LIGHTRED,string, 5);
}//not valid id
}//not connected
}
return 1;
}