03.10.2012, 11:05
how can i make this "/refill [name] [price] [reason]"
PHP код:
if(strcmp(cmd, "/refill", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pMember] == 15)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Car Mechanic!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /refill [playerid/PartOfName] [price]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(money < 1 || money > 99999) { SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1, or above 99999!"); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, " Can't do that!"); return 1; }
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Iai oferit lui %s ca sa-i faci plinu cu %dLei .",giveplayer,money);
SendClientMessage(playerid, COLOR_PURPLE, string);
format(string, sizeof(string), "* Mecanicul %s vrea sa-ti faca plinu cu %dLei, (scrie /accepta refill) pentru a accepta.",sendername,money);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RefillOffer[playa] = playerid;
RefillPrice[playa] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you / not in a car.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline.");
}
}
return 1;
}