[pawn]new Billetera[MAX_PLAYERS];[/pawn]
[pawn] else if (strcmp(cmd, "rob", true) == 0) {
tmp = strtok( cmdtext, idx ); new plr = FindPlayerIDFromString( tmp );
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: /c rob [Nick/ID]" );
else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
else if ( !IsPlayerSpawned( plr ) ) SendClientMessagef( playerid, COLOR_GREEN, "Error: %s does not spawned!", gPlayers[ plr ] );
else if(!NeedPlayerInArea(playerid,-1120.6895,-809.5638,-693.6281,-137.1244)) SendClientMessage(playerid, GREEN,"[Error] - You can only steal in an area near the bank");
else {
new Float:RX, Float:RY, Float:RZ, szMsg[256];
GetPlayerPos(playerid,RX,RY,RZ);
if(PlayerToPoint(3.0,plr,RX,RY,RZ))
format( szMsg, sizeof( szMsg ), "%s is stealing the wallet of %s", gPlayers[playerid],gPlayers[plr]);
SendClientMessageToAll( COLOR_RED, szMsg );
SetTimer("robando", 7000, false);
TogglePlayerControllable(playerid,0);
IncPlayerHandCash(playerid,150);
DecPlayerHandCash(plr,150);
Billetera[playerid] = 1;
SetPlayerMarker(playerid,15);
}
return 1;
}[/pawn]
HEM is not finish yet because contain one bug if the player "plr" not is in the area = disccount money xD
Stock AND public[pawn]
//==============================================================================
stock NeedPlayerInArea(playerid,Float:MinX,Float:MaxX,Float:MinY,Float:MaxY)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
if(x >= MinX && x <= MaxX && y >= MinY && y <= MaxY) return 1;
else return 0;
return 1;
}
//==============================================================================
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
//==============================================================================
public robando() {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(Billetera
== 0) {
}
if(Billetera == 1) {
SendClientMessage(i,COLOR_YELLOW,"You have been seen, Escape immediately!");
TogglePlayerControllable(i,1);
}
}
}
}
//==============================================================================[/pawn]
Only rob in this area