cmd wont work -
thefatshizms - 22.08.2012
Hello, i have this command i just made was kinda in a rush and did really quick so i apologise for any silly mistakes as i cant see them :/
pawn Код:
CMD:plate(playerid, params[])
{
new currentveh, newveh, msg[128], Float:X, Float:Y, Float:Z, Float:A;
if(PlayerInfo[playerid][Padmin] >=1)
{
if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /plate <message>");
currentveh = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
newveh = CreateVehicle(currentveh, X, Y, Z, A, 2, 0, -1);
SetVehicleNumberPlate(newveh, msg);
DestroyVehicle(currentveh);
PutPlayerInVehicle(playerid,newveh,0);
return 1;
}
else if(PlayerInfo[playerid][Padmin] < 1)
{
SendClientMessage(playerid, COLOR_RED, "You must be admin to use this command");
return 1;
}
return 1;
}
it shows the usage message then destroys my vehicle but doesn't create a new one
Re: cmd wont work - Glint - 22.08.2012
Quote:
Originally Posted by thefatshizms
Hello, i have this command i just made was kinda in a rush and did really quick so i apologise for any silly mistakes as i cant see them :/
pawn Код:
CMD:plate(playerid, params[]) { new currentveh, newveh, msg[128], Float:X, Float:Y, Float:Z, Float:A; if(PlayerInfo[playerid][Padmin] >=1) { if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /plate <message>"); currentveh = GetPlayerVehicleID(playerid); GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A); newveh = CreateVehicle(currentveh, X, Y, Z, A, 2, 0, -1); SetVehicleNumberPlate(newveh, msg); DestroyVehicle(currentveh); PutPlayerInVehicle(playerid,newveh,0); return 1; } else if(PlayerInfo[playerid][Padmin] < 1) { SendClientMessage(playerid, COLOR_RED, "You must be admin to use this command"); return 1; } return 1; }
it shows the usage message then destroys my vehicle but doesn't create a new one
|
Why are you destroying the vehicle ?
Re: cmd wont work - HuSs3n - 22.08.2012
pawn Код:
newveh = CreateVehicle(currentveh, X, Y, Z, A, 2, 0, -1);
idk if thats the problem ,but are you sure that (-1) respawn_delay will work ?
try changing it to 30
Re: cmd wont work -
thefatshizms - 22.08.2012
Im trying to "respawn" it so the number plate takes effect i did look at SetVehicleToRespawn but that said it will then respawn to its original position but i want it to respawn where you are
Re: cmd wont work -
thefatshizms - 22.08.2012
Quote:
Originally Posted by HuSs3n
pawn Код:
newveh = CreateVehicle(currentveh, X, Y, Z, A, 2, 0, -1);
idk if thats the problem ,but are you sure that (-1) respawn_delay will work ?
try changing it to 30
|
Yes im sure it will work this will make it so it wont respawn again i have also used this method before
Код:
This forum requires that you wait 120 seconds between posts. Please try again in 53 seconds.
Re: cmd wont work - Glint - 22.08.2012
Put this
pawn Код:
newveh = CreateVehicle(currentveh, X, Y, Z, A, 2, 0, -1);
After Destroying your vehicle.
Re: cmd wont work -
thefatshizms - 22.08.2012
Quote:
Originally Posted by Lexi'
Put this
pawn Код:
newveh = CreateVehicle(currentveh, X, Y, Z, A, 2, 0, -1);
After Destroying your vehicle.
|
still just destroys my vehicle then doesn't re create a vehicle with he same id :/
Re: cmd wont work - HuSs3n - 22.08.2012
if found the mistake
pawn Код:
currentveh = GetPlayerVehicleID(playerid);
newveh = CreateVehicle(currentveh, X, Y, Z, A, 2, 0, -1);
/*
currentveh is 'vehicle ID' not 'MODEL ID'
*/
you need to use GetVehicleModel instead
pawn Код:
CMD:plate(playerid, params[])
{
new currentveh, newveh, msg[128], Float:X, Float:Y, Float:Z, Float:A,vModel;
if(PlayerInfo[playerid][Padmin] >=1)
{
if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /plate <message>");
currentveh = GetPlayerVehicleID(playerid);
vModel = GetVehicleModel(currentveh);
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
newveh = CreateVehicle(vModel, X, Y, Z, A, 2, 0, -1);
SetVehicleNumberPlate(newveh, msg);
DestroyVehicle(currentveh);
PutPlayerInVehicle(playerid,newveh,0);
return 1;
}
else if(PlayerInfo[playerid][Padmin] < 1)
{
SendClientMessage(playerid, COLOR_RED, "You must be admin to use this command");
return 1;
}
return 1;
}
Re: cmd wont work -
thefatshizms - 22.08.2012
thanks
i always get mixed up with model and id :P