Help admin car
#1

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.
Reply
#2

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
Reply
#3

thank you very much brother... it worked..
Reply
#4

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

Kind regards,
T101
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)