I want to make a job "pizza driver"! When a player type /preparepizza to give him on hand a pizza and SETPVARINT "ArePizzaDeVanzare" == 1 ! but don't work
Код:
public PreparePizza(playerid)
{
TogglePlayerControllable(playerid,1);
SetPVarInt(playerid, "ArePizzaDeVanzare", 1); <--
SendClientMessage(playerid, COLOR_YELLOW, "Ai preparat cu succes o pizza! (Dute afara si ia un Scuter)");
SetPlayerAttachedObject( playerid, 0, 1582, 1, -0.064613, 0.520760, 0.000000, 0.000000, 84.217391, 0.000000, 1.000000, 1.000000, 1.000000 );
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_CARRY);
}
Код:
if(strcmp(cmd, "/vindepizza", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 17)
{
SendClientMessage(playerid, COLOR_GREY, "Nu esti un Pizza boy");
return 1;
}
if(GetPVarInt(playerid, "ArePizzaDeVanzare") == 0) <------
{
SendClientMessage(playerid, COLOR_GREY, "Nu ai preparat nici o pizza!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Folosire /vindepizza [Nume jucator/ID] [/pret]");
return 1;
}
new money;
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { return 1; }
money = strval(tmp);
if(money < 1 || money > 500000) { SendClientMessage(playerid, COLOR_GREY, " Pretul trebuie sa fie cuprins intre 1 si 500.000 $"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GREY, "Nu-ti poti vinde tie pizza.");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* L-ai intrebat pe %s daca vrea sa cumpere o pizza la suma de %d $", giveplayer, money);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Pizza Boy %s doreste sa-ti ofere o pizza calda la pretul de %d $ , (/accept pizza) ", sendername, money);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
VanzatorPizza[giveplayerid] = playerid;
PretPizza[giveplayerid] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Acel player nu este langa tine !");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Acel player este offline!");
}
}
return 1;
}