[COMPILE ERROR] VEH Command
#8

Quote:
Originally Posted by MP2
Посмотреть сообщение
'return' stops the code - therefore 'else' is a waste:

pawn Код:
CMD:veh(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, " ** You must be a level 3 Admin to use that! ");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Use /veh [vehicle id]");
    if(strval(params) < 400 || strval(params) > 611) return SendClientMessage(playerid, COLOR_RED, "Invalid vehicle model.");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    CreateVehicle(strval(params), x+2, y+2, z, 90.0, 0, 0, 0);
    return 1;
}
- You put a ( after the CreateVehicle line, it should have been a }.
- Coordinates shifted so vehicle doesn't spawn on top of players.
- Sscanf removed - no need if there's only one parameter (also 'u' is a PLAYER, it won't work for a vehicle ID.
Thanks MP2 you actually helped apart from people who just paste some code and say "There" you actually explain where i am going wrong so thank you <3


P.S. I am making NOOB mistakes as i have a mac and coding on a mac and compiling for some reason at only 64 bytes is kinda weird and frustrating -.-, To compile i have to explain and send it to my friends
Reply


Messages In This Thread
[COMPILE ERROR] VEH Command - by NewerthRoleplay - 30.04.2012, 20:58
Re: [COMPILE ERROR] VEH Command - by Youice - 30.04.2012, 21:05
Re: [COMPILE ERROR] VEH Command - by NewerthRoleplay - 30.04.2012, 21:09
Re: [COMPILE ERROR] VEH Command - by Youice - 30.04.2012, 21:10
Re: [COMPILE ERROR] VEH Command - by Youice - 30.04.2012, 21:12
Re: [COMPILE ERROR] VEH Command - by Max_Coldheart - 30.04.2012, 21:17
Re: [COMPILE ERROR] VEH Command - by MP2 - 30.04.2012, 22:07
Re: [COMPILE ERROR] VEH Command - by NewerthRoleplay - 30.04.2012, 22:14

Forum Jump:


Users browsing this thread: 1 Guest(s)