SA-MP Forums Archive
Help admin car - 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 admin car (/showthread.php?tid=429548)



Help admin car - DetoNater - 10.04.2013

Actually this is my cmd for admin car:

pawn Код:
CMD:acar(playerid, params[])
   {
   if(PlayerInfo[playerid][pAdmin] >= 1)
   new Float:x, Float:y, Float:z, Float:az;
   GetPlayerPos(playerid, x, y, z);
   GetPlayerFacingAngle(playerid, az);
   CreateVehicle(596, x+5, y+5, z, az, -1, -1, 180);
   return 1;
   }
but i get these errors:

Код:
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3120) : error 003: declaration of a local variable must appear in a compound block
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3120) : warning 221: label name "Float" shadows tag name
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3120) : error 017: undefined symbol "x"
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3120) : warning 215: expression has no effect
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3121) : error 017: undefined symbol "x"
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3122) : error 017: undefined symbol "az"
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3123) : error 017: undefined symbol "x"
D:\GTA SanAndreas\_Samp_\gamemodes\iBon_BF.pwn(3120) : warning 203: symbol is never used: "Float"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.



Re: Help admin car - T101 - 10.04.2013

Dear DetoNater,

Well, the very first and obvious error, that you missed a pair of braces. The correct code looks like this:

pawn Код:
CMD:acar(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new Float:x, Float:y, Float:z, Float:az;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, az);
        CreateVehicle(596, x+5, y+5, z, az, -1, -1, 180);
    }
    return 1;
}
Also, as a quick note; you'd watch for the correct indentation of your codes.


Kind regard,
T101


Re: Help admin car - DetoNater - 10.04.2013

thank you very much brother... it worked..


Re: Help admin car - T101 - 10.04.2013

It's my pleasure, that i was able to help .

Kind regards,
T101


Re: Help admin car - Gamer_007 - 10.04.2013

Be sure that if...else must have braces({}) when there are multiple lines.You dont need to use braces when u have just one line like SendClientMessage