CreateNitroPickup - 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: CreateNitroPickup (
/showthread.php?tid=372734)
CreateNitroPickup -
[D]ry[D]esert - 28.08.2012
Hello everyone i wanted to make my own nitro pickup and it work without errors.
but when i enter the pickup nothing happen, i don't get nitro.
Here is the code :
pawn Код:
stock CreateNitro(Float:x,Float:y,Float:z,VirtualWorld)
{
Create3DTextLabel("[Nitro]",0xAA3333AA,x,y,z,20,VirtualWorld);
for(new i = 0; i < MAX_PLAYERS; i++) //set a for-loop and loop through all the admins
{
if(IsPlayerInRangeOfPoint(i,5,x,y,z))
{
if(IsPlayerInAnyVehicle(i))
{
SendClientMessage(i,0xAA3333AA,"Youa are in");
AddVehicleComponent(GetPlayerVehicleID(i),1010);
}
}
}
}
Re: CreateNitroPickup -
[D]ry[D]esert - 28.08.2012
Help D: ?
Re: CreateNitroPickup -
Lukks90 - 28.08.2012
I think u need to add if(IsPlayerConnected) because of the MAX_PLAYERS loop,and u are not looping through admins,that loop is for all players
Re: CreateNitroPickup -
detter - 28.08.2012
try with this
Код:
if(IsPlayerInAnyVehicle(i))
{
new vehicle;
vehicle = GetPlayerVehicleID(i);
SendClientMessage(i,0xAA3333AA,"Youa are in");
AddVehicleComponent(vehicle,1010);
}
edit : how actually are you calling this func
Re: CreateNitroPickup -
Youice - 28.08.2012
Quote:
Originally Posted by detter
try with this
Код:
if(IsPlayerInAnyVehicle(i))
{
new vehicle;
vehicle = GetPlayerVehicleID(i);
SendClientMessage(i,0xAA3333AA,"Youa are in");
AddVehicleComponent(vehicle,1010);
}
edit : how actually are you calling this func
|
hopeless you didn't change any thing in the code , it's just like you changed the code appearance nothing else and actually and I don't want to decreed, but it's kinda function(stocks are different kind of functions that not in need"forwards" and in the same time it can't be called in some re-calls like "Timers")
Try this:
pawn Код:
stock CreateNitro(Float:x,Float:y,Float:z,VirtualWorld)
{
Create3DTextLabel("[Nitro]",0xAA3333AA,x,y,z,20,VirtualWorld);
for(new i = 0; i < MAX_PLAYERS; i++) //set a for-loop and loop through all the admins
{
if(PInfo[i][pAdmin] >= 1 &&IsPlayerInRangeOfPoint(i,5,x,y,z)) // edit this line to your basics
{
if(IsPlayerInAnyVehicle(i))
{
SendClientMessage(i,0xAA3333AA,"Youa are in");
AddVehicleComponent(GetPlayerVehicleID(i),1010);
}
}
}
return 1;
}
Re: CreateNitroPickup -
detter - 28.08.2012
Quote:
Originally Posted by Youice
hopeless you didn't change any thing in the code , it's just like you changed the code appearance nothing else and actually and I don't want to decreed, but it's kinda function(stocks are different kind of functions that not in need"forwards" and in the same time it can't be called in some re-calls like "Timers")
Try this:
pawn Код:
stock CreateNitro(Float:x,Float:y,Float:z,VirtualWorld) { Create3DTextLabel("[Nitro]",0xAA3333AA,x,y,z,20,VirtualWorld); for(new i = 0; i < MAX_PLAYERS; i++) //set a for-loop and loop through all the admins { if(PInfo[i][pAdmin] >= 1 &&IsPlayerInRangeOfPoint(i,5,x,y,z)) // edit this line to your basics { if(IsPlayerInAnyVehicle(i)) { SendClientMessage(i,0xAA3333AA,"Youa are in"); AddVehicleComponent(GetPlayerVehicleID(i),1010); } } } return 1; }
|
You did just the same thing ,put on the different cloth
and stock will not be executed if they are not called ,so it matters
Re: CreateNitroPickup -
Youice - 28.08.2012
Quote:
Originally Posted by detter
You did just the same thing ,put on the different cloth
and stock will not be executed if they are not called ,so it matters
|
well nope, I didn't do the same thing, and why would you add it, although you are not using it?, so it will must be called otherwise he can just put /* */ or removes the code