CMD:challenge(playerid, params[])
{
new rplayer, bet;
if(!sscanf(params,"ui",rplayer,bet))
{
if(IsPlayerConnected(rplayer) && !IsPlayerNPC(playerid))
{
if(IsPlayerInAnyVehicle(rplayer))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(bet <= 50000 && bet >= 5000)
{
if(GetPlayerMoney(playerid) >= bet)
{
if(GetPVarInt(rplayer,"LRRequest") == -1)
{
if(GetPVarInt(rplayer,"LR") == -1)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
if(IsPlayerInRangeOfPoint(rplayer,16,X,Y,Z))
{
new msg[24];
format(msg,24,"Bet: %i $",bet);
SendClientMessage(playerid,COLOR_LIGHTBLUE,msg);
SetPVarInt(playerid,"bet",bet);
SetPVarInt(rplayer,"bet",bet);
SetPVarInt(rplayer, "LRRequest", playerid);
SetPVarInt(playerid, "LRRequest", rplayer);
new info[160], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(info,160,"%s is asking you to start a challenege race\n with a bet of $%i, do you want to do this?",pname,bet);
ShowPlayerDialog(rplayer, 1337, DIALOG_STYLE_MSGBOX,"Challenge Race:",info,"Ofcouse","Nope");
TogglePlayerControllable(playerid,false);
} else SendClientMessage(playerid, COLOR_BRIGHTRED, "You should be near to that player.");
} else SendClientMessage(playerid, COLOR_BRIGHTRED, "Player is currently racing.");
} else SendClientMessage(playerid, COLOR_BRIGHTRED, "Player is already invited by someone.");
} else SendClientMessage(playerid, COLOR_BRIGHTRED, "You don't have that much money..");
} else SendClientMessage(playerid, COLOR_RED, "Min Amount: $5,000 Max Amount: $50,000");
} else SendClientMessage(playerid, COLOR_BRIGHTRED, "You need a vehicle to challenge someone.");
} else SendClientMessage(playerid, COLOR_BRIGHTRED, "The player you want to challenge doesn't have a vehicle.");
} else SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
} else SendClientMessage(playerid, COLOR_RED, "Usage: /challenge [Player ID] [Bet Amount]");
return true;
}
#pragma unused params
(const string1[], const string2[], bool:ignorecase(opcional), length(opcional)) String 1: Primeira string a ser comparada. String 2: Segunda string a ser comparada. Ignorecase: Diferenciar letras maiъsculas de minъsculas no comando. Length: Й o tamanho do comando, partindo de "/". |
public OnPlayerCommandText(playerid, cmdtext[]) { /** * IgnoreCase -> true: Faz com que ele ignore letras maiъsculas / minъsculas. * Length -> 10: й o tamanho do comando partindo de "/". */ if (!strcmp(cmdtext, "/challenge", true, 10)) { new rplayer, bet; if (!sscanf(params, "ui", rplayer, bet)) { if (IsPlayerConnected(rplayer) && !IsPlayerNPC(playerid)) { if (IsPlayerInAnyVehicle(rplayer)) { if (IsPlayerInAnyVehicle(playerid)) { if (bet <= 50000 && bet >= 5000) { if (GetPlayerMoney(playerid) >= bet) { if (GetPVarInt(rplayer, "LRRequest") == -1) { if (GetPVarInt(rplayer, "LR") == -1) { new Float: X, Float: Y, Float: Z; GetPlayerPos(playerid, X, Y, Z); if (IsPlayerInRangeOfPoint(rplayer, 16, X, Y, Z)) { new msg[24]; format(msg, 24, "Bet: %i $", bet); SendClientMessage(playerid, COLOR_LIGHTBLUE, msg); SetPVarInt(playerid, "bet", bet); SetPVarInt(rplayer, "bet", bet); SetPVarInt(rplayer, "LRRequest", playerid); SetPVarInt(playerid, "LRRequest", rplayer); new info[160], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(info, 160, "%s is asking you to start a challenege race\n with a bet of $%i, do you want to do this?", pname, bet); ShowPlayerDialog(rplayer, 1337, DIALOG_STYLE_MSGBOX, "Challenge Race:", info, "Ofcouse", "Nope"); TogglePlayerControllable(playerid, false); } else SendClientMessage(playerid, COLOR_BRIGHTRED, "You should be near to that player."); } else SendClientMessage(playerid, COLOR_BRIGHTRED, "Player is currently racing."); } else SendClientMessage(playerid, COLOR_BRIGHTRED, "Player is already invited by someone."); } else SendClientMessage(playerid, COLOR_BRIGHTRED, "You don't have that much money.."); } else SendClientMessage(playerid, COLOR_RED, "Min Amount: $5,000 Max Amount: $50,000"); } else SendClientMessage(playerid, COLOR_BRIGHTRED, "You need a vehicle to challenge someone."); } else SendClientMessage(playerid, COLOR_BRIGHTRED, "The player you want to challenge doesn't have a vehicle."); } else SendClientMessage(playerid, COLOR_RED, "Player is not connected."); } else SendClientMessage(playerid, COLOR_RED, "Usage: /challenge [Player ID] [Bet Amount]"); return true; } return 0; }
if (!strcmp(cmdtext, "/challenge", true, 10)) |
(const string1[], const string2[], bool:ignorecase(opcional), length(opcional)) |
(Comando, string a ser comparada com Comando, ...) |