Spawning Vehicle help - 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: Spawning Vehicle help (
/showthread.php?tid=633413)
Spawning Vehicle help -
MrFantasy - 30.04.2017
Code:
CMD:myveh(playerid, params[])
{
if(GetPVarInt(playerid, "Admin") >= 7)
{
if(GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if(IsPlayerConnected(playerid))
{
if(isnull(params))
{
SCM(playerid, COLOR_ERROR, "USAGE: /myveh [name]");
SCM(playerid, COLOR_GREY, "Available names: Sabre, FBITruck");
return 1;
}
if(strcmp(params,"Sabre",true) == 0)
{
//
}
if(strcmp(params,"FBITruck",true) == 0)
{
//
}
}
}
else SendClientMessage(playerid, COLOR_ERROR, "You do not have access to this command!");
return 1;
}
How do I make this command to work like /myveh [name] [color1] [color2]
Respuesta: Spawning Vehicle help -
Ignaciodmr - 30.04.2017
You need the "sscanf" library. (
https://sampforum.blast.hk/showthread.php?tid=570927)
Code:
CMD:myveh(playerid, params[])
{
if(GetPVarInt(playerid, "Admin") >= 7)
{
if(GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if(IsPlayerConnected(playerid))
{
new modelid, color1, color2;
if(sscanf(params, "ddd", modelid, color1, color2)) SendClientMessage(playerid, COLOR_WHITE, "Usage: /myveh [modelid] [color1] [color2]");
// Here you'll start working with the variables (Functions and everything)
}
}
else SendClientMessage(playerid, COLOR_ERROR, "You do not have access to this command!");
return 1;
}
Re: Spawning Vehicle help -
MrFantasy - 30.04.2017
Yeah but I want the player can choose the vehicle.
Code:
SCM(playerid, COLOR_ERROR, "USAGE: /myveh [name] [color1] [color2]");
SCM(playerid, COLOR_GREY, "Available names: Sabre, FBITruck");
Respuesta: Spawning Vehicle help -
Ignaciodmr - 30.04.2017
then
Code:
CMD:myveh(playerid, params[])
{
if(GetPVarInt(playerid, "Admin") >= 7)
{
if(GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if(IsPlayerConnected(playerid))
{
new modelname[20], color1, color2;
if(sscanf(params, "s[20]dd", modelname, color1, color2)) SendClientMessage(playerid, COLOR_WHITE, "Usage: /myveh [modelid] [color1] [color2]");
if(!strcmp(modelname, "Rancher", true))
{
// Spawn a rancher here.
}
//and so on with the other names u wanna add.
}
}
else SendClientMessage(playerid, COLOR_ERROR, "You do not have access to this command!");
return 1;
}
Respuesta: Spawning Vehicle help -
Ignaciodmr - 30.04.2017
Fixed?
Re: Spawning Vehicle help -
MrFantasy - 30.04.2017
Yeah, thank you