CAR ENGINE if strcmp cmd true new name MAX_PLAYER_NAME new chance rand

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//==========================================CAR ENGINE=============================================
if (strcmp(cmd, "/e", true) ==0 )
{
new name[MAX_PLAYER_NAME];
new chance = random(1000);
GetPlayerName(playerid, name, sizeof(name));
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Вы не находитесь в транспорте!");
return 1;
}
if(chance >= 100)
{
if(!ifpassenger)
{
if(Engine == 0)
{
TogglePlayerControllable(playerid,1);
format(string,sizeof(string), "*%s завел машину",name);
ProxDetector(15,playerid,string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
Engine = 1;
return 1;
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"Пассажир не может заводить/глушить двигатель!");
return 1;
}
}
else
{
TogglePlayerControllable(playerid,0);
format(string,sizeof(string), "*%s не смог завести машину",name);
ProxDetector(15,playerid,string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
Engine = 0;
return 1;
}
if(!ifpassenger)
{
if(Engine == 1)
{
TogglePlayerControllable(playerid, 1);
format(string, sizeof(string), "*%s заглушил машину.", name);
ProxDetector(15, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
RemovePlayerFromVehicle(playerid);
Engine = 0;
return 1;
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"Пассажир не может заводить/глушить двигатель!");
return 1;
}
}
//================================================================================================