Engine.
#1

Hey Guys,

I created this script:
pawn Код:
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;
}
The script suppost to start the engine when the player press LMB and it should randomly choose if the engine start or not,but when I press LMB(fire key) nothing happened.

Help guys,tnx ))
Reply
#2

Show me the code where this variable has been used.

pawn Код:
randaa
Reply
#3

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
Show me the code where this variable has been used.

pawn Код:
randaa
pawn Код:
enum randaa
{
        Suc,
        Fail
};
and in my script

Tnx for replay
Reply
#4

You can try doing something like this.

pawn Код:
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;
}
Reply
#5

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
You can try doing something like this.

pawn Код:
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;
}
I get 1 error bro:
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.
The line:
pawn Код:
new rndNum = Random(1);
Reply
#6

Help .. ? :\
Reply
#7

lowercase 'R'. And that's a bad way of checking key, read SA-MP Wiki.
Reply
#8

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
lowercase 'R'. And that's a bad way of checking key, read SA-MP Wiki.
But I don't know what is the problem P: I am here to learn P:
Reply
#9

The problem is that "Random" is invalid. It's case sensitive.

It's not the same "Random" than "random".

PHP код:
if(newkeys == KEY_FIRE)
    {
        if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
rndNum random(1);//"R" Lowercase.
    
switch(rndNum)
    {
        case 
1// Success
        
{
                
TogglePlayerControllable(playerid1);
                
engineOn[vehicle] = 1;
                
SendClientMessage(playeridCOLOR_RED"The engine started normaly.");
               
        }
        case 
0// Fail
        
{
                
engineOn[vehicle] = 0;
                
SendClientMessage(playeridCOLOR_RED"The engine didn't start,try again.");
        }
    }
    }
    return 
1;

Reply
#10

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
The problem is that "Random" is invalid. It's case sensitive.

It's not the same "Random" than "random".

PHP код:
if(newkeys == KEY_FIRE)
    {
        if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
rndNum random(1);//"R" Lowercase.
    
switch(rndNum)
    {
        case 
1// Success
        
{
                
TogglePlayerControllable(playerid1);
                
engineOn[vehicle] = 1;
                
SendClientMessage(playeridCOLOR_RED"The engine started normaly.");
               
        }
        case 
0// Fail
        
{
                
engineOn[vehicle] = 0;
                
SendClientMessage(playeridCOLOR_RED"The engine didn't start,try again.");
        }
    }
    }
    return 
1;

Pawno... O_o
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)