11.09.2016, 14:47
Bro, How to FIx it in CNR?
Pls help or contac me in fb : https://www.********.com/bloodyninja555
realesed time eror, (minus)
Pls help or contac me in fb : https://www.********.com/bloodyninja555
realesed time eror, (minus)
PHP код:
CMD:rob( playerid, params[ ] )
{
if ( PlayerInfo[ playerid ][ ActionID ] != 2 ) return SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}ERROR: {C8C8C8}You must be a robber while in a /CnR minigame to use this command!");
if ( GetPlayerTeam( playerid ) != TEAM_ROBBERS && GetPlayerTeam( playerid ) != TEAM_PROROBBERS && GetPlayerTeam( playerid ) != TEAM_EROBBERS ) return SendClientMessage(playerid,-1,"{FF0000}ERROR: {C8C8C8}You must be a robber in CnR to use this command!");
if ( IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}ERROR: {C8C8C8}You must be on foot to commit robberies.");
if ( Robstart[ playerid ] == 1 )
{
if( RobOn[ playerid ] == 1 ) return SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}ERROR: {C8C8C8}You have recently robbed a shop, you can only rob a store once every 2 minutes.");
TogglePlayerControllable(playerid,1);
robberytime=25;
robberytiming = SetTimerEx("Robberytimer",1000,1,"i",playerid);
TextDrawShowForPlayer(playerid, RobTD);
SendClientMessage( playerid, COLOR_ULTRARED,""BLUE_"Server: {DB881A}You have started a robbery, the cops have been notified!");
foreach( Player, i )
{
if ( GetPlayerTeam( i ) == TEAM_COPS || GetPlayerTeam( i ) == TEAM_ARMY || GetPlayerTeam( i ) == TEAM_SWAT )
{
if ( GetPlayerTeam( playerid ) == TEAM_ROBBERS )
{
format( gsString, sizeof( gsString ), "{004BFF}COP RADIO: {15D4ED}Suspect %s(%i) has started a robbery at the %s in %s. Units respond!", PlayerName( playerid ), playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
if ( GetPlayerTeam( playerid ) == TEAM_PROROBBERS )
{
format( gsString, sizeof( gsString ), "{004BFF}COP RADIO: {15D4ED}Suspect %s(%i) has started a robbery at the %s in %s. Units respond!", PlayerName( playerid ), playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
if ( GetPlayerTeam( playerid ) == TEAM_EROBBERS )
{
format( gsString, sizeof( gsString ), "{004BFF}COP RADIO: {15D4ED}Suspect %s(%i) has started a robbery at the %s in %s. Units respond!", PlayerName( playerid ), playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
}
}
ApplyAnimation( playerid, "SHOP", "ROB_Loop_Threat", 4.0, 1, 0, 0, 0, 0 );
RobOn[ playerid ] = ( 1 );
SetTimerEx( "RobTimmer", 120000, 0, "i", playerid );
SetPlayerAttachedObject( playerid, 0, 1550, 15, 0.016491, 0.205742, -0.208498, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 ); // Money Bag
}
else
{
new id=-255, Float:x,Float:y,Float:z;
if ( PlayerInfo[ playerid ][ ActionID ] != 2 ) return SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}ERROR: {C8C8C8}You must be a robber while in a /CnR minigame to use this command!");
if ( GetPlayerTeam( playerid ) != TEAM_ROBBERS && GetPlayerTeam( playerid ) != TEAM_PROROBBERS && GetPlayerTeam( playerid ) != TEAM_EROBBERS ) return InfoTD_MSG( playerid, 5000, "You're not a ~r~~h~Robber ~w~~h~from ~g~~h~CNR" );
GetPlayerPos(playerid,x,y,z);
if(!isnull(params))
{
sscanf(params, "u", id);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, " "RED_"» Error « {BABABA}» Error « {BABABA}This player is not connected");
else if(id == playerid) SendClientMessage(playerid,RED," "RED_"» Error « {BABABA}You can't rob yourself!");
else
{
if(IsPlayerInRangeOfPoint(id,4.00,x,y,z)) robplayer(playerid,id);
else SendClientMessage(playerid,RED," "RED_"» Error « {BABABA}This player is too far away from you!");
}
}
else
{
foreach (new i : Player)
{
if(IsPlayerInRangeOfPoint(i,4.00,x,y,z) && i != playerid)
{
id=i;
break;
}
}
if(id == -255) SendClientMessage(playerid,RED,"{FF0000}Server: {778899}No players to rob near you."); else robplayer(playerid,id);
}
}
return true;
}
stock robplayer(robber,robbed)
{
if(IsPlayerInRangeOfPoint(robber, 75, 1323.8813,2673.1052,11.2392)) return SendClientMessage(robber,RED," "RED_"» Error « {BABABA}You cannot rob players in robbers spawn place!");
if ( IsPlayerInAnyVehicle( robbed ) )
return SendClientMessage( robber, COLOR_ULTRARED, "You can not rob anyone from inside a vehicle." );
else if ( IsPlayerInAnyVehicle( robbed ) )
return SendClientMessage( robber, COLOR_YELLOW, "Player with that ID is inside in a vehicle! You can't rob him!" );
else if ( PlayerInfo[ robbed ][ RecentlyRobbed ] == 1 )
return SendClientMessage( robber, COLOR_ULTRARED, "That player has been robbed recently. Try again later." );
if ( GetPlayerMoney( robbed ) > 4999)
{
new robbedcash;
robbedcash = random( 5000 );
new string[128];
format(string,sizeof(string),"~w~ROBBED %s~nl~~w~+~g~~h~$%d~w~!",PlayerName( robbed ),robbedcash);
GameTextForPlayer(robber,string,2500,3);
new string2[128];
format(string2,sizeof(string2),"~w~%s HAS ROBBED YOU!~nl~~w~~r~-$%d~w~!",PlayerName( robber ),robbedcash);
GameTextForPlayer(robbed,string2,2500,3);
GivePlayerMoney( robber, robbedcash );
GivePlayerMoney( robbed, -robbedcash );
PlayerInfo[ robbed ][ RecentlyRobbed ] = 1;
SetTimerEx( "ResetRobVariable", 100000, 0, "i", robbed );
PlayerInfo[ robber ][ PlayerRobberies]++;
GiveMedal(robber,26);
}
else if ( GetPlayerMoney( robbed ) < 4999 )
{
gsString[ 0 ] = EOS;
format( gsString, sizeof( gsString ), "%s[ID:%d] don't have enough money for rob.", PlayerName( robbed ), robbed );
return SendClientMessage( robber, COLOR_ULTRARED, gsString );
}
return 1;
}
forward Robberytimer(playerid);
public Robberytimer(playerid)
{
new srv_string2[ 256 ];
format( srv_string2, sizeof( srv_string2 ), "~b~ROBBERY IN PROGRESS ~nl~~w~STAY IN THE STORE ~nl~~r~%d ~w~SECONDS LEFT.",robberytime);
TextDrawSetString( RobTD, srv_string2 );
robberytime--;
if(robberytime == 0)
{
KillTimer(robberytiming);
TextDrawHideForPlayer(playerid, RobTD);
donerob(playerid);
}
}
forward Jailtimer(playerid);
public Jailtimer(playerid)
{
gsString[ 0 ] = EOS;
format( gsString, sizeof( gsString ), "~b~You will be released in %d seconds.~nl~~w~Type /escape to attempt to escape", cnrjail );
InfoTD_MSG( playerid, 2000, gsString );
cnrjail--;
if(cnrjail == 0)
{
KillTimer(cnrjailtiming);
JailReleasecnr(playerid);
}
}
forward Spawntimer(playerid);
public Spawntimer(playerid)
{
new srv_string2[ 256 ];
format( srv_string2, sizeof( srv_string2 ), "You will respawn in ~y~%d ~w~Seconds.",spawntime);
TextDrawSetString( KillerTD8, srv_string2 );
spawntime--;
if(spawntime == 0)
{
KillTimer(spawntiming);
spawntiming=-1;
}
}
forward donerob(playerid);
public donerob(playerid)
{
switch( random( 2 ) )
{
case 0:
{
ClearAnimations(playerid);
GameTextForPlayer(playerid,"~r~ROBBERY FAILED",1000,5);
SendClientMessage(playerid,RED,""R"- "GRI"CnR "R"- "ORANGE_"You have failed the robbery and got away with nothing,the cops have been notified.");
}
case 1:
{
ClearAnimations(playerid);
PlayerInfo[ playerid ][ Robberies]++;
GiveMedal(playerid,25);
if ( GetPlayerTeam( playerid ) == TEAM_ROBBERS )
{
if ( PlayerInfo [ playerid ][ pVip ] >= 2)
{
GameTextForPlayer(playerid,"You have Robbed ~g~$30000",1000,5);
GivePlayerMoney( playerid , 30000 );
SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}NFS {7A7A7A}»{DBED15} {DB881A}You have successfully completed the robbery and got away with {00FF00}$30,000");
}
else
{
GameTextForPlayer(playerid,"You have Robbed ~g~$15000",1000,5);
GivePlayerMoney( playerid , 15000 );
SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}NFS {7A7A7A}»{DBED15} {DB881A}You have successfully completed the robbery and got away with {00FF00}$15,000");
}
}
if ( GetPlayerTeam( playerid ) == TEAM_PROROBBERS )
{
if ( PlayerInfo [ playerid ][ pVip ] >= 2)
{
GameTextForPlayer(playerid,"You have Robbed ~g~$50000",1000,5);
GivePlayerMoney( playerid , 50000 );
SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}NFS {7A7A7A}»{DBED15} {DB881A}You have successfully completed the robbery and got away with {00FF00}$50,000");
}
else
{
GameTextForPlayer(playerid,"You have Robbed ~g~$25000",1000,5);
GivePlayerMoney( playerid , 25000 );
SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}NFS {7A7A7A}»{DBED15} {DB881A}You have successfully completed the robbery and got away with {00FF00}$25,000");
}
}
if ( GetPlayerTeam( playerid ) == TEAM_EROBBERS )
{
if ( PlayerInfo [ playerid ][ pVip ] >= 2)
{
GameTextForPlayer(playerid,"You have Robbed ~g~$70000",1000,5);
GivePlayerMoney( playerid , 70000 );
SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}NFS {7A7A7A}»{DBED15} {DB881A}You have successfully completed the robbery and got away with {00FF00}$70,000");
}
else
{
GameTextForPlayer(playerid,"You have Robbed ~g~$35000",1000,5);
GivePlayerMoney( playerid , 35000 );
SendClientMessage( playerid, COLOR_ULTRARED,"{FF0000}NFS {7A7A7A}»{DBED15} {DB881A}You have successfully completed the robbery and got away with {00FF00}$35,000");
}
}
foreach( Player, i )
{
if( PlayerInfo[ i ][ InCNR] == 1 )
{
if ( GetPlayerTeam( playerid ) == TEAM_ROBBERS )
{
if ( PlayerInfo [ playerid ][ pVip ] >= 2)
{
format( gsString, sizeof( gsString ), "{7A7A7A}[CnR] {87CEFA}%s(%i) has robbed the %s in %s and got away with {00FF00}$30,000", PlayerName( playerid ),playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
else
{
format( gsString, sizeof( gsString ), "{7A7A7A}[CnR] {87CEFA}%s(%i) has robbed the %s in %s and got away with {00FF00}$15,000", PlayerName( playerid ),playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
}
if ( GetPlayerTeam( playerid ) == TEAM_PROROBBERS )
{
if ( PlayerInfo [ playerid ][ pVip ] >= 2)
{
format( gsString, sizeof( gsString ), "{7A7A7A}[CnR] {87CEFA}%s(%i) has robbed the %s in %s and got away with {00FF00}$50,000", PlayerName( playerid ),playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
else
{
format( gsString, sizeof( gsString ), "{7A7A7A}[CnR] {87CEFA}%s(%i) has robbed the %s in %s and got away with {00FF00}$25,000", PlayerName( playerid ),playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
}
if ( GetPlayerTeam( playerid ) == TEAM_EROBBERS )
{
if ( PlayerInfo [ playerid ][ pVip ] >= 2)
{
format( gsString, sizeof( gsString ), "{7A7A7A}[CnR] {87CEFA}%s(%i) has robbed the %s in %s and got away with {00FF00}$70,000", PlayerName( playerid ),playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
else
{
format( gsString, sizeof( gsString ), "{7A7A7A}[CnR] {87CEFA}%s(%i) has robbed the %s in %s and got away with {00FF00}$35,000", PlayerName( playerid ),playerid,PlayerInfo[ playerid ][ ShopRobbed ],PlayerInfo[ playerid ][ Zone ]);
SendClientMessage( i, COLOR_ULTRARED,gsString);
}
}
}
}
}
}
return 1;
}