27.09.2009, 19:00
Hello. I am currently making a CnR script.
It all seemd good until a few mins ago where i with a friend tested alittle on it.
When using 1 of the commands on ID 0 it thinks i dont write a ID
Heres an example of 1 of the commands
It all seemd good until a few mins ago where i with a friend tested alittle on it.
When using 1 of the commands on ID 0 it thinks i dont write a ID
Heres an example of 1 of the commands
Код:
dcmd_rob(playerid,params[])
{
if(robber[playerid] == 0)
{
return 0;
}
else
{
new tmp[255],idx;
tmp = strtok(params,idx);
if(!strval(tmp))
{
SendClientMessage(playerid,COLOUR_RED,"USAGE: /rob [ID]");
return 1;
}
else
{
pid = strval(tmp);
if(!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOUR_RED,"ERROR: Player is not connected");
return 1;
}
else
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(pid,X,Y,Z);
if(!PlayerToPoint(5,playerid,X,Y,Z))
{
SendClientMessage(playerid,COLOUR_RED,"ERROR: You are to far away too rob targeted ID");
return 1;
}
if(robtimer[playerid] == 1)
{
SendClientMessage(playerid,COLOUR_RED,"ERROR: You must wait before robbing again!");
return 1;
}
else
{
robtimer[playerid] = 1;
new ammount,string[100],string1[120],name[MAX_PLAYER_NAME],name1[MAX_PLAYER_NAME];
ammount = GetPlayerMoney(playerid)/2;
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(pid,name1,sizeof(name1));
GivePlayerMoney(pid,-ammount);
GivePlayerMoney(playerid,ammount);
format(string,sizeof(string),"You have succesfully robbed %s from %s",ammount,name1);
format(string1,sizeof(string1),"You have been robbed %s by %s",ammount,name);
SendClientMessage(playerid,COLOUR_YELLOW,string);
SendClientMessage(pid,COLOUR_RED,string1);
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+1);
SetTimer("robtimerone",120000,false);
return 1;
}
}
}
}
}

