Command for a specific name - 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: Command for a specific name (
/showthread.php?tid=597091)
Command for a specific name -
Bondage - 26.12.2015
As the topic says how do i make a specific command for a specific name?
Re: Command for a specific name -
xXRevolverXx - 26.12.2015
Can you explain more so i can help you, thanks.
Re: Command for a specific name -
SaltySandy - 26.12.2015
Just check if the command is executed by that specific player
What command processor do you use / what command do you want to have converted?
Re: Command for a specific name -
lucamsx - 26.12.2015
Get players name (
https://sampwiki.blast.hk/wiki/GetPlayerName) to a variable, and check if variable is same as the specified name.
If not, return 0 or error message.
Re: Command for a specific name -
Bondage - 29.12.2015
how can i make this command for a specified name instead of level?
pawn Код:
CMD:fix(playerid,params[])
{
#pragma unused params
if(PlayerInfo[playerid][Level] >= 1) {
if (IsPlayerInAnyVehicle(playerid)) {
RepairVehicle(GetPlayerVehicleID(playerid));
SetVehicleHealth(GetPlayerVehicleID(playerid),1250.0);
return SendClientMessage(playerid,blue,"Vehicle Fixed");
} else return SendClientMessage(playerid,red,"Error: You are not in a vehicle");
} else return SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command");
}
Re: Command for a specific name -
AndySedeyn - 29.12.2015
https://sampwiki.blast.hk/wiki/Strcmp
https://sampwiki.blast.hk/wiki/GetPlayerName
Re: Command for a specific name -
Bondage - 29.12.2015
need an example code
Re: Command for a specific name -
CrazyChoco - 29.12.2015
Read those two wikis. It's not that hard.
Re: Command for a specific name -
Tamy - 29.12.2015
Код:
CMD:fix(playerid,params[])
{
#pragma unused params
new name[32];
GetPlayerName(playerid, name,32);
if(!strcmp(name, "name here", false) {
if (IsPlayerInAnyVehicle(playerid)) {
RepairVehicle(GetPlayerVehicleID(playerid));
SetVehicleHealth(GetPlayerVehicleID(playerid),1250.0);
return SendClientMessage(playerid,blue,"Vehicle Fixed");
} else return SendClientMessage(playerid,red,"Error: You are not in a vehicle");
} else return SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command");
}
Re: Command for a specific name -
Bondage - 30.12.2015
Quote:
Originally Posted by CrazyChoco
Read those two wikis. It's not that hard.
|
And this post is really really helpful!
Btw thank you Tamp and IzadorO