SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 11/07/2013, 01:16 PM   #1
DJRebis
Big Clucker
 
DJRebis's Avatar
 
Join Date: Mar 2013
Location: Latvia
Posts: 104
Reputation: -2
Default Cmd not working

Hi, the cmd is liek this:
Code:
if (strcmp("/route", cmdtext, true, 10) == 0)
    {
		if(IsPlayerInVehicle(playerid, 537))
		ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Routes","Los Santos to San Fierro to Los Santos \nLos Santos to Las Venturas1 to Las Venturas2 to Los Santos \nLos Santos to San Fierro to Las Venturas2 \nLos Santos to Los Santos all stops","OK","Cancel");
        return 1;
    }
But when i do it nothing happens! Whats wrong?
__________________
[ND]Neon Drifters
[Map]Bus Station
[Map]Small Scientist base
[Map]City Island

DJRebis is offline   Reply With Quote
Old 11/07/2013, 02:22 PM   #2
DJRebis
Big Clucker
 
DJRebis's Avatar
 
Join Date: Mar 2013
Location: Latvia
Posts: 104
Reputation: -2
Default Re: Cmd not working

P.S. even when im in that vehicle dialog dosen't appier! ??
__________________
[ND]Neon Drifters
[Map]Bus Station
[Map]Small Scientist base
[Map]City Island

DJRebis is offline   Reply With Quote
Old 11/07/2013, 03:34 PM   #3
DJRebis
Big Clucker
 
DJRebis's Avatar
 
Join Date: Mar 2013
Location: Latvia
Posts: 104
Reputation: -2
Default Re: Cmd not working

Anyone?
__________________
[ND]Neon Drifters
[Map]Bus Station
[Map]Small Scientist base
[Map]City Island

DJRebis is offline   Reply With Quote
Old 11/07/2013, 03:39 PM   #4
Dragonsaurus
Huge Clucker
 
Dragonsaurus's Avatar
 
Join Date: Apr 2013
Location: Albania | Vlora
Posts: 494
Reputation: 52
Default Re: Cmd not working

Isn't 537 the Freight train's ID? The correct usage of IsPlayerInVehicle is like below:
pawn Code:
IsPlayerInVehicle(playerid, vehicleid);
So use it this way:
pawn Code:
if(GetVehicleModel(vehicleid) == 537 && IsPlayerInAnyVehicle(playerid))
Dragonsaurus is offline   Reply With Quote
Old 11/07/2013, 03:50 PM   #5
DJRebis
Big Clucker
 
DJRebis's Avatar
 
Join Date: Mar 2013
Location: Latvia
Posts: 104
Reputation: -2
Default Re: Cmd not working

Looks like this now:
Code:
if (strcmp(cmdtext, "/route", true) == 0)
    {
        if IsPlayerInVehicle(playerid, vehicleid);
        if(GetVehicleModel(vehicleid) == 537 && IsPlayerInAnyVehicle(playerid))
    	{
		ShowPlayerDialog(playerid,9999,DIALOG_STYLE_LIST,"Routes","Los Santos to San Fierro to Los Santos \nLos Santos to Las Venturas1 to Las Venturas2 to Los Santos \nLos Santos to San Fierro to Las Venturas2 \nLos Santos to Los Santos all stops","OK","Cancel");
		return 1;
		}
But 4 errors:
Code:
undefined symbol "vehicleid"
expected token: "*then", but found ";"
empty statement
Without ''if'' infront of IsPlayerInVehicle was 12 errors!!
__________________
[ND]Neon Drifters
[Map]Bus Station
[Map]Small Scientist base
[Map]City Island

DJRebis is offline   Reply With Quote
Old 11/07/2013, 03:57 PM   #6
LendaDaMorte
Little Clucker
 
Join Date: Jun 2013
Posts: 9
Reputation: 1
Default Re: Cmd not working

Alguém poderia me ajudar no comando /r ? (rádio para caminhoneiros em comboio) Game Mode PPC_Trucking!
Obrigado!




px01.carbonhost.com.br:7781
LendaDaMorte is offline   Reply With Quote
Old 11/07/2013, 03:58 PM   #7
DJRebis
Big Clucker
 
DJRebis's Avatar
 
Join Date: Mar 2013
Location: Latvia
Posts: 104
Reputation: -2
Default Re: Cmd not working

Quote:
Originally Posted by LendaDaMorte View Post
Alguém poderia me ajudar no comando /r ? (rádio para caminhoneiros em comboio) Game Mode PPC_Trucking!
Obrigado!




px01.carbonhost.com.br:7781
English,pls??
__________________
[ND]Neon Drifters
[Map]Bus Station
[Map]Small Scientist base
[Map]City Island

DJRebis is offline   Reply With Quote
Old 11/07/2013, 03:59 PM   #8
Dragonsaurus
Huge Clucker
 
Dragonsaurus's Avatar
 
Join Date: Apr 2013
Location: Albania | Vlora
Posts: 494
Reputation: 52
Default Re: Cmd not working

pawn Code:
if (strcmp(cmdtext, "/route", true) == 0)
    {
        if(GetVehicleModel(vehicleid) == 537 && IsPlayerInAnyVehicle(playerid))
        {
        ShowPlayerDialog(playerid,9999,DIALOG_STYLE_LIST,"Routes","Los Santos to San Fierro to Los Santos \nLos Santos to Las Venturas1 to Las Venturas2 to Los Santos \nLos Santos to San Fierro to Las Venturas2 \nLos Santos to Los Santos all stops","OK","Cancel");
        return 1;
        }

Take a look at this to understandhow it works: http://wiki.sa-mp.com/wiki/Function:IsPlayerInVehicle
Vehicleid is not the same as Model ID. Model is the number that is constant for every kind of vehicle, and vehicleid is the id of the vehicle ig-game. e.g, if you have spawned 3 vehicles (no matter what kind of vehicles), the fast vehicle's id is 3 etc.
Dragonsaurus is offline   Reply With Quote
Old 11/07/2013, 04:00 PM   #9
mahdi499
Big Clucker
 
mahdi499's Avatar
 
Join Date: Aug 2009
Location: Palestine
Posts: 165
Reputation: 9
Default Re: Cmd not working

pawn Code:
if (strcmp(cmdtext, "/route", true) == 0)
{
    if(IsPlayerInVehicle(playerid))
    {
        if(GetVehicleModel(vehicleid) == 537)
        {
        ShowPlayerDialog(playerid,9999,DIALOG_STYLE_LIST,"Routes","Los Santos to San Fierro to Los Santos \nLos Santos to Las Venturas1 to Las Venturas2 to Los Santos \nLos Santos to San Fierro to Las Venturas2 \nLos Santos to Los Santos all stops","OK","Cancel");
        return 1;
        }
}
}

you understood if wrongfully you can't use If without () and a statment of Then after it.
mahdi499 is offline   Reply With Quote
Old 11/07/2013, 04:03 PM   #10
Dragonsaurus
Huge Clucker
 
Dragonsaurus's Avatar
 
Join Date: Apr 2013
Location: Albania | Vlora
Posts: 494
Reputation: 52
Default Re: Cmd not working

Use IsPlayerInAnyVehicle instead of IsPlayerInVehicle
Dragonsaurus 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working Vehicle storage system (100% working) eclipses Scripting Help 6 14/10/2012 09:13 PM
[HELP!] GTA SA:MP Is not working Mikedorst Client Support 4 19/09/2012 01:35 PM
Why it isn't working? TheChaoz Help Archive 4 30/12/2009 11:39 PM


All times are GMT. The time now is 02:37 AM.


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