Help with command
#1

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;
}
Reply
#2

PHP код:
CMD:slap(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid0xF81414"Greska! Morate biti admin da bi koristili ovu komandu");
    new 
targetid;
    new 
Float:xFloat:yFloat:z;
    
GPP(targetidxyz);
    if(
sscanf(params"u"targetid)) return SCM(playerid0xFFFFFF"Koriscenje: /slap [ID]");
    if(!
IPC(targetid))
    {
        
SCM(playerid0xF81414"Greska! Taj igrac nije na serveru");
    }
    
SPP(targetidxyz+5);
    }
    return 
1;

and if this don't work can you show me the "SPP" function? the problem can be from it
Reply
#3

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(playeridparams[]) {
    if(
PlayerInfo[playerid][pAdmin] >= 1) {
        return 
SCM(playerid0xF81414"Greska! Morate biti admin da bi koristili ovu komandu");
    }
    if(
sscanf(params"u"params[0])) {
        return 
SCM(playerid0xFFFFFF"Koriscenje: /slap [ID]");
    }
    new 
Float:xFloat:yFloat:z;
    if(!
GPP(params[0], xyz)) {
        return 
SCM(playerid0xF81414"Greska! Taj igrac nije na serveru");
    }
    return 
SPP(params[0], xy5.0);

Reply
#4

@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(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < 1)return SCM(playerid0xF81414"Greska! Morate biti admin da bi koristili ovu komandu");
    new 
targetid;
    if(
sscanf(params,"u",targetid))return SCM(playerid0xFFFFFF"Koriscenje: /slap [ID]");
    {
        if(!
IPC(targetid))return SCM(playerid0xF81414"Greska! Taj igrac nije na serveru");
        new 
Float:xFloat:yFloat:z;
        
GPP(targetidxyz);
        
SPP(targetidxyz+5);
    }
    return 
1;

Reply
#5

Now i saw i have same problems with some other commands -_-
Reply
#6

Do the same, use "return" SendClientMessage to stop the rest of the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)