Help with command - 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)
+--- Thread: Help with command (
/showthread.php?tid=605907)
Help with command -
Micko123 - 26.04.2016
What is problem in this cmd?? When i press /slap it slaps me and shows how to use command. When i press /slap 2 it slaps player. How can i fix bug when it slap me when i dont put ID in? Hope you understood it
Код:
CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new targetid;
new Float:x;
new Float:y;
new Float:z;
GPP(targetid, x, y, z);
if(sscanf(params, "u", targetid))
{
SCM(playerid, 0xFFFFFF, "Koriscenje: /slap [ID]");
}
if(!IPC(targetid))
{
SCM(playerid, 0xF81414, "Greska! Taj igrac nije na serveru");
}
SPP(targetid, x, y, z+5);
}
else
{
SCM(playerid, 0xF81414, "Greska! Morate biti admin da bi koristili ovu komandu");
}
return 1;
}
Re: Help with command -
mongi - 26.04.2016
PHP код:
CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid, 0xF81414, "Greska! Morate biti admin da bi koristili ovu komandu");
new targetid;
new Float:x, Float:y, Float:z;
GPP(targetid, x, y, z);
if(sscanf(params, "u", targetid)) return SCM(playerid, 0xFFFFFF, "Koriscenje: /slap [ID]");
if(!IPC(targetid))
{
SCM(playerid, 0xF81414, "Greska! Taj igrac nije na serveru");
}
SPP(targetid, x, y, z+5);
}
return 1;
}
and if this don't work can you show me the "SPP" function? the problem can be from it
Re: Help with command -
Nero_3D - 27.04.2016
Just add some returns
Quote:
Originally Posted by mongi
and if this don't work can you show me the "SPP" function?
|
I guess it should be the short for SetPlayerPos because typing it out is each time is outrageous
PHP код:
CMD:slap(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 1) {
return SCM(playerid, 0xF81414, "Greska! Morate biti admin da bi koristili ovu komandu");
}
if(sscanf(params, "u", params[0])) {
return SCM(playerid, 0xFFFFFF, "Koriscenje: /slap [ID]");
}
new Float:x, Float:y, Float:z;
if(!GPP(params[0], x, y, z)) {
return SCM(playerid, 0xF81414, "Greska! Taj igrac nije na serveru");
}
return SPP(params[0], x, y, z + 5.0);
}
Re: Help with command -
GangstaSunny - 27.04.2016
@Micko123
Well, you check the sscanf part of the command and also the !IPC. The problem is that the !IPC have to be inside of the commend
PHP код:
CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1)return SCM(playerid, 0xF81414, "Greska! Morate biti admin da bi koristili ovu komandu");
new targetid;
if(sscanf(params,"u",targetid))return SCM(playerid, 0xFFFFFF, "Koriscenje: /slap [ID]");
{
if(!IPC(targetid))return SCM(playerid, 0xF81414, "Greska! Taj igrac nije na serveru");
new Float:x, Float:y, Float:z;
GPP(targetid, x, y, z);
SPP(targetid, x, y, z+5);
}
return 1;
}
Re: Help with command -
Micko123 - 27.04.2016
Now i saw i have same problems with some other commands -_-
Re: Help with command -
CalvinC - 27.04.2016
Do the same, use "return" SendClientMessage to stop the rest of the command.