05.12.2009, 11:49
i want to add in this command a timer which the player can use the command every 15 seconds
PAWN Code:
dcmd_rob(playerid, params[])
{
if (strlen(params))
{
id = strval(params);
if (IsPlayerConnected(id) && (gTeam[playerid] == TEAM_CIVIL) && (GetDistanceBetweenPlayers( playerid, id) < 3.0 ) && (gTeam[id] != TEAM_COPS) && (gTeam[id] != TEAM_CIA))
{
if(GetPlayerWantedLevel(id) == 0)
{
if(id != playerid)
{
SendClientMessage(id, COLOR_RED , "You have been Robbed -1000$");
SendClientMessage(playerid, 0x00FF00AA, "You Have robbed 1000$");
GivePlayerMoney(playerid, 1000);
GivePlayerMoney(id, -1000);
SetPlayerScore(playerid, GetPlayerScore( playerid ) +1 );
SetPlayerWantedLevel( playerid, GetPlayerWantedLevel( playerid )+1 );
GameTextForPlayer(playerid, "~y~Player Robbed~n~+1000$", 3500, 3);
GameTextForPlayer(id, "~y~You have been Robbed~n~-1000$", 3500, 3);
}
else
{
SendClientMessage(playerid, COLOR_RED , "You can not rob your self!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED , "You are not a Civilian to use this, or there is no player nearby.");
SendClientMessage(playerid, COLOR_RED , "You can not rob cops or agents!");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/rob <playerid>\"");
}
return 1;
PAWN Code:
dcmd_rob(playerid, params[])
{
if (strlen(params))
{
id = strval(params);
if (IsPlayerConnected(id) && (gTeam[playerid] == TEAM_CIVIL) && (GetDistanceBetweenPlayers( playerid, id) < 3.0 ) && (gTeam[id] != TEAM_COPS) && (gTeam[id] != TEAM_CIA))
{
if(GetPlayerWantedLevel(id) == 0)
{
if(id != playerid)
{
SendClientMessage(id, COLOR_RED , "You have been Robbed -1000$");
SendClientMessage(playerid, 0x00FF00AA, "You Have robbed 1000$");
GivePlayerMoney(playerid, 1000);
GivePlayerMoney(id, -1000);
SetPlayerScore(playerid, GetPlayerScore( playerid ) +1 );
SetPlayerWantedLevel( playerid, GetPlayerWantedLevel( playerid )+1 );
GameTextForPlayer(playerid, "~y~Player Robbed~n~+1000$", 3500, 3);
GameTextForPlayer(id, "~y~You have been Robbed~n~-1000$", 3500, 3);
}
else
{
SendClientMessage(playerid, COLOR_RED , "You can not rob your self!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED , "You are not a Civilian to use this, or there is no player nearby.");
SendClientMessage(playerid, COLOR_RED , "You can not rob cops or agents!");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/rob <playerid>\"");
}
return 1;