Cmd not working
#1

Hi, the cmd is liek this:
Код:
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?
Reply
#2

P.S. even when im in that vehicle dialog dosen't appier! ??
Reply
#3

Anyone?
Reply
#4

Isn't 537 the Freight train's ID? The correct usage of IsPlayerInVehicle is like below:
pawn Код:
IsPlayerInVehicle(playerid, vehicleid);
So use it this way:
pawn Код:
if(GetVehicleModel(vehicleid) == 537 && IsPlayerInAnyVehicle(playerid))
Reply
#5

Looks like this now:
Код:
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:
Код:
undefined symbol "vehicleid"
expected token: "*then", but found ";"
empty statement
Without ''if'' infront of IsPlayerInVehicle was 12 errors!!
Reply
#6

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




px01.carbonhost.com.br:7781
Reply
#7

Quote:
Originally Posted by LendaDaMorte
Посмотреть сообщение
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??
Reply
#8

pawn Код:
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: https://sampwiki.blast.hk/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.
Reply
#9

pawn Код:
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.
Reply
#10

Quote:
Originally Posted by mahdi499
Посмотреть сообщение
pawn Код:
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.
Still 1 error:
Код:
error 017: undefined symbol "vehicleid"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)