02.07.2013, 21:42
Okay, so I've been making a level command, but when i use the command in game, without adding PlayerID or card id
it gives me this, witch is right
But, when I use for example /givecard 1 1 it gives out unknown command, even If I only use /givecard 1 it gives it.
Here is the whole code:
it gives me this, witch is right
pawn Код:
SendClientMessage(playerid, COLOR_GREY, "USAGE: /givecard [1 == Green] ");
Here is the whole code:
pawn Код:
if(strcmp("/givecard", cmdtext, true, 10) == 0)
{
new string[512 char];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /givecard [1 == Green] ");
return 1;
}
new player;
new level;
player = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
new name[MAX_PLAYER_NAME+1];
new name1[MAX_PLAYER_NAME+1];
GetPlayerName(player, name, sizeof(name));
GetPlayerName(playerid, name1, sizeof(name));
if(PlayerInfo[playerid][Alogined] == 1)
{
if(IsPlayerConnected(player))
{
if(player != INVALID_PLAYER_ID)
{
if(level < 0 || level > 5) return SendClientMessage(playerid, COLOR_GREY,"* Only levels 0-5 Are allowed!");
if(level == 1)
{
format(string, sizeof(string), "%s has granted you green army keycard.", name1);
SendClientMessage(player, COLOR_GREY, string);
format(string, sizeof(string), "You've granted %s green army keycard.", name);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[player][Cgreen] = 1;
}
if(level == 2)
{
format(string, sizeof(string), "%s has granted you blue army keycard.", name1);
SendClientMessage(player, COLOR_GREY, string);
format(string, sizeof(string), "You've granted %s blue army keycard.", name);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[player][Cblue] = 1;
}
if(level == 3)
{
format(string, sizeof(string), "%s has granted you orange army keycard.", name1);
SendClientMessage(player, COLOR_GREY, string);
format(string, sizeof(string), "You've granted %s orange army keycard.", name);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[player][Corange] = 1;
}
if(level == 4)
{
format(string, sizeof(string), "%s has granted you red army keycard.", name1);
SendClientMessage(player, COLOR_GREY, string);
format(string, sizeof(string), "You've granted %s red army keycard.", name);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[player][Cred] = 1;
}
if(level == 5)
{
format(string, sizeof(string), "%s has granted you full army access keycard.", name1);
SendClientMessage(player, COLOR_GREY, string);
format(string, sizeof(string), "You've granted %s full army access keycard.", name);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[player][Call] = 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[ERROR]: Wrong Playerid ID!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[ERROR]: Rcon Admin Only!!!");
}
return 1;
}