Problem with my /cks script! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with my /cks script! (
/showthread.php?tid=88054)
Problem with my /cks script! -
Ben147 - 24.07.2009
When im tryed to accept the ck request
its say me
"Sorry, the Killer or Dieer ain't Online"
And they are both online!!! i really need help !
Here is my script:
Код:
if(strcmp(cmd, "/cks", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin !");
return 1;
}
new ck;
new number = 0;
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
for(new i = 0; i < sizeof(CKInfo); i++)
{
number ++;
if(CKInfo[i][cUsed] != 0)
{
format(string, sizeof(string), "%d| %s wants to Character Kill %s.",number,CKInfo[i][cSendername],CKInfo[i][cGiveplayer]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
if(strcmp(x_nr,"accept",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cks accept [cknumber]");
return 1;
}
ck = strval(tmp);
if(ck < 1 || ck > 10) { SendClientMessage(playerid, COLOR_GREY, " CK Number can't be below 1 or above 10 !"); return 1; }
ck -= 1;
new found1 = 255;
new found2 = 255;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(found1 != 255 && found2 != 255)
{
new wstring[MAX_PLAYER_NAME];
GetPlayerName(i, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "%s", giveplayer);
strmid(wstring, string, 0, strlen(string), 255);
if(strcmp(CKInfo[ck][cSendername] ,wstring, true ) == 0 )
{
found1 = i;
}
else if(strcmp(CKInfo[ck][cGiveplayer] ,wstring, true ) == 0 )
{
found2 = i;
}
}
}
}
if(found1 != 255 && found2 != 255)
{
GetPlayerName(found2, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* An Admin has accepted your Character Kill, you can now perform your kill on %s.", giveplayer);
SendClientMessage(found1, COLOR_LIGHTBLUE, string);
OnCK[found1] = found2;
GettingCK[found2] = found1;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW2, "Sorry, the Killer or Dieer ain't Online.");
return 1;
}
}
else if(strcmp(x_nr,"delete",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cks delete [cknumber]");
return 1;
}
ck = strval(tmp);
if(ck < 1 || ck > 10) { SendClientMessage(playerid, COLOR_GREY, " CK Number can't be below 1 or above 10 !"); return 1; }
ck -= 1;
ClearCK(ck);
ck += 1;
format(string, sizeof(string), "* You've cleared Character Kill nr: %d", ck);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Invalid CK command name !");
return 1;
}
}
return 1;
}
Thanks for all
Re: Problem with my /cks script! -
Joe Staff - 24.07.2009
Do a debug test to verify what the variables "found1" and "found2" are equalling out to be after performing the command. I often time use "printf" for such debug operations.
Re: Problem with my /cks script! -
Ben147 - 26.07.2009
How , what is wrong in my ck script?
Re: Problem with my /cks script! -
Ben147 - 26.07.2009
*BUMP* i really need solvesion i dont know where is the script problem
Re: Problem with my /cks script! -
Lilcuete - 23.01.2010
Anyone i have that problem to and ready posted it in godfather no one replys please tell me