SA-MP Forums Archive
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=328750)



Help with command - godoy32 - 25.03.2012

Hi, I have a problem with a lot of commands. Happens that if you type for example "/slap" the command runs good, but in one part say "Unknown command", I don't know why happen that.
So, here's the command
pawn Код:
COMMAND:slap(playerid,params[])
{
    if(Informacion[playerid][Admin] >= 2)
    {
        new id;
        if(sscanf(params,"u",id))
        {
            if(Informacion[id][Idioma]==0) SendClientMessage(playerid,-1,"Usa: {FF0000}/bofetear {FFFFFF}[ID/Nombre]");
            if(Informacion[id][Idioma]==1) SendClientMessage(playerid,-1,"Use: {FF0000}/slap {FFFFFF}[ID/Name]");
            return 1;
        }
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"Jugador no conectado");
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(id,X,Y,Z);
        SetPlayerPos(id,X,Y,Z+15);
        GameTextForPlayer(id,"~r~SLAP!",5000,4);
        new st[128 char];
        format(st,128,"Has bofeteado a {FF0000}%s (%d)",pNick(id),id);
        SendClientMessage(playerid,-1,st); //all is good here - the message is displayed
        PlayerPlaySound(id,1190,0.0,0.0,0.0); //HERE IS THE PROBLEM. No sound is played
    }
    return 1;
}
That happen with another command too (/are - accept report)

Sorry for the English, I'm learning.


Re: Help with command - Twisted_Insane - 25.03.2012

pawn Код:
else return SendClientMessage(playerid, COLOR, "You need to be level 2 to use that command!");
return 1;



Respuesta: Re: Help with command - godoy32 - 25.03.2012

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
pawn Код:
else return SendClientMessage(playerid, COLOR, "You need to be level 2 to use that command!");
return 1;
still happening


Re: Help with command - Reklez - 26.03.2012

i do not see the problem you have return 1; all fine

pawn Код:
PlayerPlaySound(id,1190,0.0,0.0,0.0);
this is not a problem this will only play sound in slap-id. if you want to hear the sound

duplicate the PlayerPlaySound then do this

pawn Код:
PlayerPlaySound(playerid,1190,0.0,0.0,0.0);



Re: Help with command - [HiC]TheKiller - 26.03.2012

You should try playing the player sound at the players position rather than at the middle of the map. Secondly, the unknown command error may be caused by an error in your command processor. Try using
pawn Код:
print("THISCALLED");
after PlayerPlaySound. If this is called, it's the command processor, otherwise the command seems to be skipping at that point.