SA-MP Forums Archive
/slap 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: /slap command (/showthread.php?tid=298617)



/slap command - SomebodyAndMe - 21.11.2011

Код:
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(4) : error 001: expected token: "-identifier-", but found "["
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(8) : error 027: invalid character constant
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(8) : warning 217: loose indentation
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(9) : error 017: undefined symbol "Name"
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(9) : error 017: undefined symbol "Name"
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(9) : error 029: invalid expression, assumed zero
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(9) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
These six errors I get when my command try to compile.

Current pawn code:
pawn Код:
COMMAND:slap(playerid,params[])
{  
    new OtherPlayer, Msg,[150], Name[24], Message[150], OtherPlayerName[24];
    SendAdminText(playerid,"/slap", params);
   
    if (APlayerData[playerid][PlayerLevel] >= 2)
'   {
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
        format(Msg, sizeof(MSg), "%s Slaps %s because %s", Name, OtherPlayerName, Message);
        SendClientMessageToAll(0xFFFFFFFF, Msg);
        SetPlayerHealth(OtherPlayer, 75);
    }
    else
        return 0;
}
I Try to make it like:

* SomebodyAndMe slaps 1 annoying around a bit with a large trout.
Sendclientmessagetoall: Admin: "adminname" slaps "otherplayername" because "reason".
Then the other player will lose 25% health.


Anyone knows a fix or the whole command?


Re: /slap command - FireCat - 21.11.2011

pawn Код:
COMMAND:slap(playerid,params[])
{  
    new OtherPlayer, Msg,[150], Name[24], Message[150], OtherPlayerName[24];
    SendAdminText(playerid,"/slap", params);
   
    if (APlayerData[playerid][PlayerLevel] >= 2)
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
        format(Msg, sizeof(MSg), "%s Slaps %s because %s", Name, OtherPlayerName, Message);
        SendClientMessageToAll(0xFFFFFFFF, Msg);
        SetPlayerHealth(OtherPlayer, 75);
    }
    else
    {
        return 0;
    }
    return 1;
}



Re: /slap command - sleepysnowflake - 21.11.2011

Did you even included <a_samp> and <zcmd> ?


Re: /slap command - Kostas' - 21.11.2011

Lol guys , look it better
pawn Код:
Msg,[150]
He wrote a "," before the [150]
pawn Код:
COMMAND:slap(playerid,params[])
{
    new OtherPlayer, Msg[150], Name[24], Message[150], OtherPlayerName[24];
    SendAdminText(playerid,"/slap", params);
    if (APlayerData[playerid][PlayerLevel] >= 2) {
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
        format(Msg, sizeof(MSg), "%s Slaps %s because %s", Name, OtherPlayerName, Message);
        SendClientMessageToAll(0xFFFFFFFF, Msg);
        SetPlayerHealth(OtherPlayer, 75);
    }
    else {
        return 0;
    }
    return 1;
}



Re: /slap command - KingHual - 21.11.2011

Код:
Msg,[150]
I'm pretty sure that fails alot...
also this
Код:
    if (APlayerData[playerid][PlayerLevel] >= 2)
'   {
fails too... remove the '


Re: /slap command - SomebodyAndMe - 21.11.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
pawn Код:
COMMAND:slap(playerid,params[])
{  
    new OtherPlayer, Msg,[150], Name[24], Message[150], OtherPlayerName[24];
    SendAdminText(playerid,"/slap", params);
   
    if (APlayerData[playerid][PlayerLevel] >= 2)
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
        format(Msg, sizeof(MSg), "%s Slaps %s because %s", Name, OtherPlayerName, Message);
        SendClientMessageToAll(0xFFFFFFFF, Msg);
        SetPlayerHealth(OtherPlayer, 75);
    }
    else
    {
        return 0;
    }
    return 1;
}
Not working, getting this:

Код:
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(4) : error 001: expected token: "-identifier-", but found "["
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(9) : error 017: undefined symbol "Name"
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(9) : error 017: undefined symbol "Name"
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(9) : error 029: invalid expression, assumed zero
C:\Users\kevin.H1964542\Desktop\SAMP Kevin\pawno\include\PPC_PlayerCommands.inc(9) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
and
Quote:

Did you even included <a_samp> and <zcmd> ?

I did


Re: /slap command - Camacorn - 21.11.2011

User fixed problem, removed.


Re: /slap command - KingHual - 21.11.2011

Try this:
Код:
COMMAND:slap(playerid,params[])
{  
    new OtherPlayer, Msg[150], Name[24], Message[150], OtherPlayerName[24];
    SendAdminText(playerid,"/slap", params);
   
    if (APlayerData[playerid][PlayerLevel] >= 2)
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
        format(Msg, sizeof(MSg), "%s Slaps %s because %s", Name, OtherPlayerName, Message);
        SendClientMessageToAll(0xFFFFFFFF, Msg);
        SetPlayerHealth(OtherPlayer, 75);
    }
    else
    {
        return 0;
    }
    return 1;
}



Re: /slap command - SomebodyAndMe - 21.11.2011

Fixed the problem sorry im so tired and need to fix server. Thanks all for the support!


Re: /slap command - SomebodyAndMe - 21.11.2011

UPDATE, problem not fixed, now only the user with ID 0 gets slapped.