#1

What is the problem here ?

I tried it like that:
PHP код:
CMD:car(playeridparams[])
{
if(
PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playeridCOLOR_RED"You can't use this command");
new 
caridcolor1color2;
new 
Float:xFloat:yFloat:z;
if(
sscanf(params"uii"caridcolor1color2)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /car [id] (Color 1) (Color 2)");
if(
carid 411 && carid 611)
{
GetPlayerPos(playeridxyz);
new 
car CreateVehicle(caridxyzcolor1color2, -1);
new 
interior GetPlayerInterior(playerid);
LinkVehicleToInterior(carinterior);
new 
world GetPlayerVirtualWorld(playerid);
SetVehicleVirtualWorld(carworld);
SendClientMessage(playeridCOLOR_BROWN"Vehcile Spawned");
}
else
{
SendClientMessage(playeridCOLOR_RED"Car id can't be less than 411 or more than 611");
}
return 
1;

And like that
PHP код:
CMD:car(playeridparams[])
{
if(
PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playeridCOLOR_RED"You can't use this command");
new 
caridcolor1color2;
new 
Float:xFloat:yFloat:z;
if(
sscanf(params"uii"caridcolor1color2)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /car [id] (Color 1) (Color 2)");
if(
carid 411 || carid 611) return SendClientMessag(playeridCOLOR_RED"Car is can't be less than 411 or more than 611");
GetPlayerPos(playeridxyz);
new 
car CreateVehicle(caridxyzcolor1color2, -1);
new 
interior GetPlayerInterior(playerid);
LinkVehicleToInterior(carinterior);
new 
world GetPlayerVirtualWorld(playerid);
SetVehicleVirtualWorld(carworld);
SendClientMessage(playeridCOLOR_BROWN"Vehcile Spawned");
return 
1;

And both give me this


Please help !!
Reply
#2

about "u"

Quote:

u - User, takes a name, part of a name or an id and returns the id if they're connected.

it's deprecated too!

so for example, if you wrote 233 as carid, it'll search for the player with the id 233
but couldn't find any and thus carid became 0
so that the control statement would look like:
pawn Код:
if(0 < 411 || 0 > 611)
which makes no sense and always equals true cuz 0 will always be smaller than 411 (unless youre dealing with complex numbers)

try
pawn Код:
sscanf(params, "ddd", carid, color1, color2)
sscanf wiki
Reply
#3

Thank you
Reply
#4

Another thing please why when the vehicle explode it respawn again at the same place that i spawn it ?
Reply
#5

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
Another thing please why when the vehicle explode it respawn again at the same place that i spawn it ?
cuz CreateVehicle's position is at the same time the spawn point of the vehicle
if you want to change that, you have to destroy the vehicle and create it again at a new position

that's hop ppls do the parking thing in RP servers for example.
they do /park -> vehicle gets recreated at new spot
Reply
#6

No i want when the vehicle destroy it totally deaspear
Reply
#7

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
No i want when the vehicle destroy it totally deaspear
so this will destroy it once it's "dead"

pawn Код:
public OnVehicleDeath(vehicleid, killerid)//applies to every vehicle. once destroyed it'll be deleted
{
    DestroyVehicle(vehicleid);
    return 1;
}
there's one problem though, the callback will also be called if
the vehicle enters water.
you could evaluate the killerid to check if its water.
the killerid for water is 0. But 0 could also be a playerid :P

but you don't need to mess with that if youre okey with it getting destroyed
once its drowning in water
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)