03.06.2014, 04:52
I'd just like to throw it out there that I'm still learning the way loops and structures go. I'm not an expert by any means, so if you could elaborate on what I've done wrong I would appreciate it so I can learn.
The issue is quite simple. When a player does /sellicecream I'd like it to say their not in a vehicle before it shows the "usage [params]" message. I'd also like to know how "break;" and "continue;" work in looping structures.
Here's the current code:
Thanks for any assistance.
The issue is quite simple. When a player does /sellicecream I'd like it to say their not in a vehicle before it shows the "usage [params]" message. I'd also like to know how "break;" and "continue;" work in looping structures.
Here's the current code:
pawn Код:
//Icecream man
CMD:sellicecream(playerid, params[])
{
if(pInfo[playerid][pJobID] !=3) return SCM(playerid,COLOR_GREY, "[ERROR]: You must be an Icecream Man to sell ice cream.");
new price, target;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(GetPlayerVehicleID(playerid) == IceCreamJobVehicle[i])
{
break;
}
if(i==MAX_VEHICLES-1) return SCM(pid,COLOR_GREY, "You need to be in a icecream truck to use this command.");
}
if(sscanf(params, "ud", target, price)) return SCM(pid,COLOR_WHITE, "USAGE: /sellicecream [playerid] [price 2-25$]");
if(price > 25 || price < 2) return SCM(pid,COLOR_GREY, "[ERROR]: Prices out of range. (2-25$)");
if(target == INVALID_PLAYER_ID) return SCM(pid,COLOR_GREY, "[ERROR]: playerid is not connected to the server.");
return 1;
}