SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/03/2020, 05:40 PM   #1
Calinut200
Big Clucker
 
Join Date: Jun 2016
Posts: 74
Reputation: 0
Default Help

Helo! i make a player textdraw for speedometer, all work only not
"Vehicle: X"
I found a include to get vehiclename and to show it and don't work.
If i make something like that is working
PHP Code:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    new 
String[128];
    
format(String,sizeof(String),"You are entering a(n) %s.",VehicleNames[GetVehicleModel(vehicleid) - 400]);
    
SendClientMessage(playerid,-1,String);
    return 
1;

But if i try to make this is don't work
PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    
// intra in masina
    
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
         
SetTimerEx("speed"750true"i"playerid);
         new 
string1[128];
         
format(string1,sizeof(string1),"Vehicle: %s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
        
PlayerTextDrawSetString(playeridcartypestring1);
        
PlayerTextDrawShow(playeridcartype);
        
PlayerTextDrawShow(playerid,cartype);
    }
    
// IESE DIN MASINA GATA SPEEDU
    
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {

    }
    return 
1;

PHP Code:
C:\Users\Calinacho\Desktop\server  samp\gamemodes\test.pwn(331) : error 017undefined symbol "vehicleid" 
Some help?
Calinut200 is offline   Reply With Quote
Old 29/03/2020, 05:52 PM   #2
Nuginity
Big Clucker
 
Nuginity's Avatar
 
Join Date: Feb 2020
Location: Indonesia (Jakarta)
Posts: 58
Reputation: 2
Default Re: Help

here you're

PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    
// intra in masina
    
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
         
SetTimerEx("speed"750true"i"playerid);
         new 
string1[128], vehicleid GetPlayerVehicleID(playerid);
         
format(string1,sizeof(string1),"Vehicle: %s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
        
PlayerTextDrawSetString(playeridcartypestring1);
        
PlayerTextDrawShow(playeridcartype);
        
PlayerTextDrawShow(playerid,cartype);
    }
    
// IESE DIN MASINA GATA SPEEDU
    
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {

    }
    return 
1;

You forget to declare the vehicleid variable, thats all
Nuginity is offline   Reply With Quote
Old 29/03/2020, 06:02 PM   #3
Calinut200
Big Clucker
 
Join Date: Jun 2016
Posts: 74
Reputation: 0
Default Re: Help

Quote:
Originally Posted by Nuginity View Post
here you're

PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    
// intra in masina
    
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
         
SetTimerEx("speed"750true"i"playerid);
         new 
string1[128], vehicleid GetPlayerVehicleID(playerid);
         
format(string1,sizeof(string1),"Vehicle: %s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
        
PlayerTextDrawSetString(playeridcartypestring1);
        
PlayerTextDrawShow(playeridcartype);
        
PlayerTextDrawShow(playerid,cartype);
    }
    
// IESE DIN MASINA GATA SPEEDU
    
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {

    }
    return 
1;

You forget do declare the vehicleid variable, thats all
Thank you bro <3
Calinut200 is offline   Reply With Quote
Old 29/03/2020, 06:08 PM   #4
Nuginity
Big Clucker
 
Nuginity's Avatar
 
Join Date: Feb 2020
Location: Indonesia (Jakarta)
Posts: 58
Reputation: 2
Default Re: Help

Quote:
Originally Posted by Calinut200 View Post
Thank you bro <3
Anytime dude
__________________
Nusantara Freeroam
Current Stage : ALPHA
-------------------------------------------
We Need an Indonesian's Scripter now!
Nuginity is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 08:39 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.