SA-MP Forums Archive
why this command dont work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: why this command dont work? (/showthread.php?tid=294390)



why this command dont work? - Admigo - 01.11.2011

Heey all,
Why this command dont work?
pawn Код:
if(!strcmp(cmdtext,"/selltest"))
    {
        if(GetPlayerVehicleID(playerid) == 520)
        {
            GivePlayerMoney(playerid,10000);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have sold a vehicle to the shipyard for $10000.");// for $%d
            return 1;
        }
        if(GetPlayerVehicleID(playerid) == 521)
        {
            GivePlayerMoney(playerid,11000);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have sold a vehicle to the shipyard for $11000.");// for $%d
            return 1;
        }
        return 1;
    }
Thank admigo


Re: why this command dont work? - DaBeezy - 01.11.2011

put it in [pawn]use pawn tag


Re: why this command dont work? - Admigo - 01.11.2011

I have now.


Re: why this command dont work? - Vetle - 01.11.2011

you have to use GetVehicleModel to get the vehicle model, GetPlayerVehicleID returns the vehicle id.


Re: why this command dont work? - Admigo - 01.11.2011

Dont work
Now i have :
pawn Код:
if(!strcmp(cmdtext,"/selltest"))
    {
        if(GetVehicleModel(playerid) == 520)
        {
            GivePlayerMoney(playerid,10000);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have sold a vehicle to the shipyard for $10000.");// for $%d
            return 1;
        }
        if(GetVehicleModel(playerid) == 521)
        {
            GivePlayerMoney(playerid,11000);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have sold a vehicle to the shipyard for $11000.");// for $%d
            return 1;
        }
        return 1;
    }



Re: why this command dont work? - Vetle - 01.11.2011

GetVehicleModel takes 1 argument, which is vehicleid. To get the player's vehicleid you would use GetPlayerVehicleID. To get the model of the vehicle that the player is inside, you would use GetVehicleModel(GetPlayerVehicleID(playerid)).
pawn Код:
if(!strcmp(cmdtext,"/selltest"))
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
        {
            GivePlayerMoney(playerid,10000);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have sold a vehicle to the shipyard for $10000.");// for $%d
            return 1;
        }
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 521)
        {
            GivePlayerMoney(playerid,11000);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have sold a vehicle to the shipyard for $11000.");// for $%d
            return 1;
        }
        return 1;
    }