26.12.2013, 13:53
pawn Код:
CMD:sladoled(playerid,params[])
{
if(PlayerInfo[playerid][pJob] != 26)
{
SendClientMessage(playerid, COLOR_GREY, " You dont have the job!"); return 1;
}
new tmpcar = GetPlayerVehicleID(playerid);
if(IsASladCar(tmpcar))
{
new string[128],idx;
string = strtok(params, idx);
if(!strlen(string)) { SendClientMessage(playerid, COLOR_GRAD2, "HELP: /sladoled [playerid/PartOfName] [cjena]"); return 1; }
new gid = ReturnUser(string);
string = strtok(params, idx);
if(!strlen(string)) { SendClientMessage(playerid, COLOR_GRAD2, "HELP: /sladoled [playerid/PartOfName] [cjena]"); return 1; }
new money = strval(string),name[24];
if(money < 1 || money > 50)
{
SendClientMessage(playerid, COLOR_GREY, " Price cant be lower than 1$ or more than!"); return 1;
}
if(IsPlayerConnected(gid))
{
if(ProxDetectorS(8.0, playerid, gid))
{
if(gid == playerid)
{
SendClientMessage(playerid, COLOR_GREY, " You cant give a icecream to yourself !"); return 1;
}
GetPlayerName(gid, name, sizeof(name));
format(string, sizeof(string), "* You sold an iceccream to %s for $%d.", name, money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* IceMan %s wants to sell you a $%d, (typej /accept sladoled) to accept.", name, money);
SendClientMessage(gid, COLOR_LIGHTBLUE, string);
IceCreamOffer[gid] = playerid; IceCreamPrice[gid] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " The player is not near you!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " The player is offline.!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not in a Ice-cream Truck.");
}
return 1;
}