27.02.2010, 19:47
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/buylicense", true) == 0)
{
if(IsPlayerConnected(playerid) && PlayerToPoint(2.0, playerid, 361.8299,173.6302,1008.3828))
{
TogglePlayerControllable(playerid, 0);
ShowPlayerDialog(playerid, LICMENU, DIALOG_STYLE_LIST, "Odaberi Licencu","Voznja $2000\nLetenje $5000\nPlovidba $800\nOruzje $8000", "Kupi", "Cancel");
return 1;
}
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == LICMENU)
{
if(response)
{
if(listitem == 0) // Car Liceses
{
if (PlayerInfo[playerid][pCarLic] == 0 && GetPlayerMoney(playerid) > 49)
{
GivePlayerMoney(playerid,-2000);
PlayerInfo[playerid][pCarLic] = 1;
SendClientMessage(playerid, COLOR_GREEN, " Kupio si vozacku dozvolu!");
SendClientMessage(playerid, COLOR_GRAD5, " Mozes provijeriti licence ako upises /licenses !");
TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Vec imas licencu za voznju, ili nemas dovoljno novaca!");
TogglePlayerControllable(playerid, 1);
}
}
if(listitem == 1) // Flying Licenses
{
if (GetPlayerMoney(playerid) > 4999)
{
GivePlayerMoney(playerid,-5000);
PlayerInfo[playerid][pFlyLic] = 1;
SendClientMessage(playerid, COLOR_GREEN, " Kupio si dozvolu za Letenje!");
SendClientMessage(playerid, COLOR_GRAD5, "Mozes provijeriti licence ako upises /licenses !");
TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Vec imas licencu za voznju, ili nemas dovoljno novaca!");
TogglePlayerControllable(playerid, 1);
}
}
if(listitem == 2) // Sail Licenses
{
if (GetPlayerMoney(playerid) > 799)
{
GivePlayerMoney(playerid,-800);
PlayerInfo[playerid][pBoatLic] = 1;
SendClientMessage(playerid, COLOR_GREEN, " Kupio si dozvolu za brod!");
SendClientMessage(playerid, COLOR_GRAD5, "Mozes provijeriti licence ako upises /licenses !");
TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Vec imas licencu za voznju, ili nemas dovoljno novaca!");
TogglePlayerControllable(playerid, 1);
}
}
if(listitem == 3) // Gun licenses
{
if (GetPlayerMoney(playerid) > 799)
{
GivePlayerMoney(playerid,-8000);
PlayerInfo[playerid][pGunLic] = 1;
SendClientMessage(playerid, COLOR_GREEN, " Kupio si dozvolu za oruzje!");
SendClientMessage(playerid, COLOR_GRAD5, "Mozes provijeriti licence ako upises /licenses !");
TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Vec imas licencu za voznju, ili nemas dovoljno novaca!");
TogglePlayerControllable(playerid, 1);
}
}
}
return 1;
}