10.01.2016, 03:54
I've been trying to write some commands and see how it goes as its been a while so I opened a new PAWNO file and started working on it, I wrote four commands and went in game to test them
However, every time I try to type any command, it would just return this message "/ban playerid", doesnt matter what I write, that message would appear unless I type /ban "id" then I would lose connection.
Its been so long and I cant really figure out the problem, help would be greatly appreciated, thanks!
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new giveplayerid;
new cmd[128], idx;
if(strcmp(cmd, "/kick", true) == 0)
{
new kicker[128];
new tmp[128];
tmp = strtok(cmdtext, idx);
{
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Use /kick [playerid]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
format(kicker, sizeof(kicker), "You have kicked Player ID : %d from the server.", giveplayerid);
SendClientMessage(playerid, 0xFFFFFFFF, kicker);
Kick(strval(tmp));
return 1;
}
}
}
if(strcmp(cmd, "/ban", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
{
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Use /ban [playerid]");
return 1;
}
Ban(strval(tmp));
return 1;
}
}
if(strcmp(cmd, "/afk", true) == 0)
{
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
strins(pName, "[AFK]", 0);
SetPlayerName(playerid, pName);
return 1;
}
if(strcmp(cmd, "/giveplayergun", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Use /giveplayergun [playerid] [gun-id]");
return 1;
}
new gunidstring[128];
new gunget;
new gun;
gunget = ReturnUser(tmp);
gun = strvalEx(tmp);
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "You know the guns.");
if(IsPlayerConnected(gunget))
{
GivePlayerWeapon(gunget, gun, 99999);
format(gunidstring, sizeof(gunidstring), "Admin %s has give you the weapon ID : %d", playerid, gun);
SendClientMessage(gunget, 0xFFFFFFFF, gunidstring);
}
else { SendClientMessage(playerid, 0xFFFFFFFF, "That player is offline!"); }
return 1;
}
return 0;
}
Its been so long and I cant really figure out the problem, help would be greatly appreciated, thanks!


