SA-MP Forums Archive
/vslap help please ! - 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: /vslap help please ! (/showthread.php?tid=381577)



/vslap help please ! - Rapk1d - 30.09.2012

Someone have a /vslap script ? ( vehicle slap ) , i have this script but when i compile it ..
Код:
 C:\Users\Alexunder\Desktop\godfatherNEW.pwn(36761) : warning 202: number of arguments does not match definition
C:\Users\Alexunder\Desktop\godfatherNEW.pwn(36761) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
i got this.

My script =>>>
Код:
//----------------------[VSlap]---------------
if(strcmp(cmd, "/vslap", true) == 0) {
        if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pAdmin] >= 1) {
            new id = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid,COLOR_GREEN ,"[HELP]: /vslap [carid]");
                return 1;
            }
            id = GetPlayerVehicleID(playerid);
            new Float:x, Float:y, Float:z;
            GetVehiclePos(id, x, y, z);
            SetVehiclePos(id, x, y, z+5);
            format(string, sizeof(string),"[ADMIN] %s has slapped car id %s",GetPlayerName(playerid), id);

            return 1;
            }
        }



Re: /vslap help please ! - basse - 30.09.2012

There is no problem? there's only warnings? they are harmless


Re: /vslap help please ! - Rapk1d - 30.09.2012

Quote:
Originally Posted by basse
Посмотреть сообщение
There is no problem? there's only warnings? they are harmless
Ok . this is the line with problem
Код:
format(string, sizeof(string),"[ADMIN] %s has slapped car id %s",GetPlayerName(playerid), id);
What is the problem ? Why don't leave me to compile it.. ? !


Re: /vslap help please ! - 2KY - 30.09.2012

You have to get their name inside of the function, you can't use it inside of a format.

pawn Код:
new playerName [ MAX_PLAYER_NAME ];

GetPlayerName( playerid, playerName, sizeof( playerName ) );

format( string, sizeof ( string ), "[ADMIN] %s has slapped car id %s",playerName, id);



Re: /vslap help please ! - newbienoob - 30.09.2012

Quote:
Originally Posted by basse
Посмотреть сообщение
There is no problem? there's only warnings? they are harmless
You can only ignore 2 warnings
Код:
warning 217: loose indentation
warning 203: symbol is never used: ****
You can ignore the rest of it, but your command/function will not work.


Re: /vslap help please ! - Rapk1d - 30.09.2012

Thanks i just solved the problem.
Here de script for others person.
Код:
if(strcmp(cmd, "/vslap", true) == 0) {
        if(PlayerInfo[playerid][pAdmin] >= 1) {
            new id = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid,COLOR_GREEN ,"[HELP]: /vslap [carid]");
                return 1;
            }
            id = GetPlayerVehicleID(playerid);
            new Float:x, Float:y, Float:z;
            GetVehiclePos(id, x, y, z);
            SetVehiclePos(id, x, y, z+5);
            format(string, sizeof(string),"[ADMIN] %s has slapped car id %s",GetPlayerVehicleID(playerid), id);

            return 1;
            }
        }



Re: /vslap help please ! - 2KY - 30.09.2012

Quote:
Originally Posted by Rapk1d
Посмотреть сообщение
Thanks i just solved the problem.
Here de script for others person.
Код:
if(strcmp(cmd, "/vslap", true) == 0) {
        if(PlayerInfo[playerid][pAdmin] >= 1) {
            new id = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid,COLOR_GREEN ,"[HELP]: /vslap [carid]");
                return 1;
            }
            id = GetPlayerVehicleID(playerid);
            new Float:x, Float:y, Float:z;
            GetVehiclePos(id, x, y, z);
            SetVehiclePos(id, x, y, z+5);
            format(string, sizeof(string),"[ADMIN] %s has slapped car id %s",GetPlayerVehicleID(playerid), id);

            return 1;
            }
        }
No....

pawn Код:
if(strcmp(cmd, "/vslap", true) == 0) {
        if(PlayerInfo[playerid][pAdmin] >= 1) {
            new id = strval(tmp), plName [ 24 ];
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid,COLOR_GREEN ,"[HELP]: /vslap [carid]");
                return 1;
            }
            GetPlayerName( playerid, plName, 24 );
            new Float:x, Float:y, Float:z;
            GetVehiclePos(id, x, y, z);
            SetVehiclePos(id, x, y, z+5);
            format(string, sizeof(string),"[ADMIN] %s has slapped car id %s",plName, id);

            return 1;
            }
        }
would solve your problem.