if(newkeys == KEY_FIRE)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
switch(randaa)
{
case Suc:
{
TogglePlayerControllable(playerid, 1);
engineOn[vehicle] = 1;
SendClientMessage(playerid, COLOR_RED, "The engine started normaly.");
}
case Fail:
{
engineOn[vehicle] = 0;
SendClientMessage(playerid, COLOR_RED, "The engine didn't start,try again.");
}
}
}
return 1;
}
randaa
Show me the code where this variable has been used.
pawn Код:
|
enum randaa
{
Suc,
Fail
};
if(newkeys == KEY_FIRE)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new rndNum = Random(1);
switch(rndNum)
{
case 1: // Success
{
TogglePlayerControllable(playerid, 1);
engineOn[vehicle] = 1;
SendClientMessage(playerid, COLOR_RED, "The engine started normaly.");
}
case 0: // Fail
{
engineOn[vehicle] = 0;
SendClientMessage(playerid, COLOR_RED, "The engine didn't start,try again.");
}
}
}
return 1;
}
You can try doing something like this.
pawn Код:
|
C:\GTA - San Andreas\Server\gamemodes\Rp11Back.pwn(56438) : error 017: undefined symbol "Random"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
new rndNum = Random(1);
lowercase 'R'. And that's a bad way of checking key, read SA-MP Wiki.
|
if(newkeys == KEY_FIRE)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new rndNum = random(1);//"R" Lowercase.
switch(rndNum)
{
case 1: // Success
{
TogglePlayerControllable(playerid, 1);
engineOn[vehicle] = 1;
SendClientMessage(playerid, COLOR_RED, "The engine started normaly.");
}
case 0: // Fail
{
engineOn[vehicle] = 0;
SendClientMessage(playerid, COLOR_RED, "The engine didn't start,try again.");
}
}
}
return 1;
}
The problem is that "Random" is invalid. It's case sensitive.
It's not the same "Random" than "random". PHP код:
|