SA-MP Forums

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

Thread Tools Display Modes
Old 20/06/2013, 12:03 PM   #1
Huge Clucker
Donvalley's Avatar
Join Date: Jul 2007
Location: Australia
Posts: 411
Reputation: 26
Default If Player Is In Vechile

How To Set This To If Player Is In ComTruck it doesnt do the else return

pawn Code:
if(GetPlayerVehicleID(playerid) <= ComTruck[0] && GetPlayerVehicleID(playerid) >= ComTruck[12])
 else return SendClientMessage(playerid, GREY, "    You can only deliver in a truck.");

I am not a Master Scripter. But if you have a problem i will happily try my best to help, so if a bit of code i wrote doesn't work you don't have to-Rep me for it. I am trying my best to help you.
Donvalley is offline   Reply With Quote
Old 20/06/2013, 12:07 PM   #2
MP2's Avatar
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: If Player Is In Vechile

That is not the correct way to do this at all. You need to loop through each truck ID and check if they are in it. You can't just assume the IDs are consecutive (i.e. 4, 5, 6, 7 and . Your if/else structure is also wrong.

pawn Code:
new vehicleid = GetPlayerVehicleID(playerid);

for(new i=0; i < sizeof(ComTruck); i++)
    if(vehicleid == ComTruck[i])
        // They are in truck 'i', code here
// Not in a truck
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote

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
need help for taxi it must get money from player and also teleport player when countdown ends Player23 Scripting Help 2 14/11/2012 08:41 AM
[Request] Set(Player)ObjectSize / Size parameters in Create(Player)Object [03]Garsino Help Archive 3 28/11/2010 05:12 PM
vechile respawn geordieke Help Archive 0 16/02/2010 06:09 PM

All times are GMT. The time now is 08:05 AM.

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