How to create a vehicle with a specific ID? [HELP] -
FlapnaadPro - 29.02.2012
Hello everyone,
I've been trying to figure out how to make a command like: /createveh [Vehicle TYPE],
which then spawns that vehicle on my possition, forcing me behind the wheel.
I do have a /deleteveh cmd which is fully functional without bugs nor errors and looks like this:
Код:
CMD:deleteveh(playerid, params[])
{
if ( GetPVarInt( playerid, "Level" ) < 4 )
return SendClientMessage( playerid, -1, "You must be the "COL_LIGHTBLUE""Level4"{FFFFFF} to delete a vehicle.");
{
new vehicleid, string[64];
if(!sscanf(params, "i", vehicleid))
{
DestroyVehicle(vehicleid);
format(string, sizeof(string), ""COL_LIGHTBLUE"Vehicle ID:{FFFFFF} %d has been succesfully deleted.", vehicleid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
if ( sscanf( params, "uS", params[ 0 ]) )
return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /deleteveh <Vehicle ID>");
}
return 1;
}
Been using that to figure out the /createveh command,
but hasn't worked for me so far.
Been struggeling with this for a couple of days now,
help would be much appreciated.
Regards,
FlapnaadPro
EDIT:
I do know that deleting a vehicle has nothing to do with creating one,
but this may help you understand how I am currently attempting to learn scripting.
Thus helping you to help me.
Re: How to create a vehicle with a specific ID? [HELP] -
FlapnaadPro - 01.03.2012
Is anyone in a possition to help me?
Since I'm stuck now, with the rest of the script...
Since I can't test anything else without that command working.
You don't have to give me the script if you don't want too.
Atleast explain it to me, how I could accomplish my goal.
After all, I'm here to learn scripting, else I wouldn't be here.
Regards,
FlapnaadPro
Re: How to create a vehicle with a specific ID? -
Deduction - 01.03.2012
You got Skype? or anything?
Re: How to create a vehicle with a specific ID? -
Deduction - 01.03.2012
BTW heres the code:
pawn Код:
CMD:createveh(playerid, params[])
{
if ( GetPVarInt( playerid, "Level" ) < 4 )
return SendClientMessage( playerid, -1, "You must be the "COL_LIGHTBLUE""Level4"{FFFFFF} to create a vehicle.");
{
new modelid, col1, col2, float:X, float:Y, float:Z, float:angle, string[64];
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, angle);
if(!sscanf(params, "i", modelid, col1, col2))
{
CreateVehicle(modelid, X, Y, Z, angle, col1, col2, 0);
format(string, sizeof(string), """COL_LIGHTBLUE"Vehicle Model ID:{FFFFFF} %d has been succesfully Spawned.", modelid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
if ( sscanf( params, "uS", params[ 0 ]) )
return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /createveh <Vehicle ID> <Color 1> <Color 2>");
}
return 1;
}
pawn Код:
If this helped you, I will accept +REP // :)
Re: How to create a vehicle with a specific ID? -
Dragony92 - 01.03.2012
if(!sscanf(params, "i", modelid, col1, col2))
LoL
Re: How to create a vehicle with a specific ID? -
AWP Gaming - 01.03.2012
Try giving the vehicle a specific playerid to link it to.
We can complete this task in under 2 minutes if you would like.
Re: How to create a vehicle with a specific ID? -
Deduction - 01.03.2012
His there to learn, I aint going to give him a working code, only a half working code.
He needs to learn to fix it.
It still has the basics needed to spawn vehicles.
Re: How to create a vehicle with a specific ID? -
FlapnaadPro - 01.03.2012
Alright what I did now was just copy the code giving above and insert it into my GM,
but now this happend:
Код:
..\location\gamemodes\sc-rp.pwn(164) : warning 213: tag mismatch
..\location\gamemodes\filename.pwn(164) : warning 213: tag mismatch
..\location\gamemodes\filename.pwn(164) : warning 213: tag mismatch
..\location\gamemodes\filename.pwn(165) : warning 213: tag mismatch
..\location\gamemodes\filename.pwn(168) : warning 213: tag mismatch
..\location\gamemodes\filename.pwn(168) : warning 213: tag mismatch
..\location\gamemodes\filename.pwn(168) : warning 213: tag mismatch
..\location\gamemodes\filename.pwn(168) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
8 Warnings.
And yes, I know you only gave me half a code,
but if you don't explain how to fix it and just give half a code I won't learn it either.
Since I still don't know what is wrong and how to fix it.
Now I simply just have half a code without getting any wiser.
So, some explaination would help me big time.
Regards,
FlapnaadPro
Re: How to create a vehicle with a specific ID? -
FlapnaadPro - 01.03.2012
Quote:
Originally Posted by Deduction
pawn Код:
If this helped you, I will accept +REP // :)
|
And if this ends up helping me (in my opinion),
I would.
By the way:
Quote:
Originally Posted by Deduction
pawn Код:
format(string, sizeof(string), """COL_LIGHTBLUE"Vehicle Model ID:{FFFFFF} %d has been succesfully Spawned.", modelid);
|
Should be:
Quote:
Originally Posted by FlapnaadPro
pawn Код:
format(string, sizeof(string), ""COL_LIGHTBLUE"Vehicle Model ID:{FFFFFF} %d has been succesfully spawned.", modelid);
|
Re: How to create a vehicle with a specific ID? -
Deduction - 01.03.2012
Try this:
pawn Код:
CMD:createveh(playerid, params[])
{
new float:X, float:Y, float:Z;
GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
new modelid, col1, col2, string[64];
new float:angle;
GetPlayerFacingAngle(playerid, Float:angle);
if ( GetPVarInt( playerid, "Level" ) < 4 )
return SendClientMessage( playerid, -1, "You must be the "COL_LIGHTBLUE""Level4"{FFFFFF} to create a vehicle.");
{
if(sscanf(params, "d", modelid, col1, col2))
{
CreateVehicle(modelid, Float:X, Float:Y, Float:Z, Float:angle, col1, col2, 0);
format(string, sizeof(string), ""COL_LIGHTBLUE"Vehicle Model ID:{FFFFFF} %d has been succesfully Spawned.", modelid);
SendClientMessage(playerid, 0xFFFFFFFF, string);
return 1;
}
if ( sscanf( params, "uS", params[ 0 ]) )
return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /createveh <Vehicle ID> <Color 1> <Color 2>");
}