Making a CMD for a specific person.
#1

As none of the code worked, I'll put the thread back up-_-

I need to make a command which only someone with a certain name can use.

Here's the code:

PHP код:
CMD:greg(playerid,params[])
{
 new 
carid;
 
SetPlayerSkin(playerid,240);
 
SetPlayerHealth(playerid,99999);
 
SetPlayerArmour(playerid,99999);
 
GivePlayerWeapon(playerid,1,9999);
 
GivePlayerWeapon(playerid,4,9999);
 
GivePlayerWeapon(playerid,18,9999);
 
GivePlayerWeapon(playerid,24,9999);
 
GivePlayerWeapon(playerid,27,9999);
 
GivePlayerWeapon(playerid,29,9999);
 
GivePlayerWeapon(playerid,31,9999);
 
GivePlayerWeapon(playerid,34,9999);
 
GivePlayerWeapon(playerid,36,9999);
 
GivePlayerWeapon(playerid,44,9999);
 new 
Float:X,Float:Y,Float:Z;
 
GetPlayerPos(playeridXYZ);
 
carid CreateVehicle(522,XYZ,0,233,142,-1);
 
PutPlayerInVehicle(playeridcarid0);
 return 
1;

Reply
#2

pawn Код:
CMD:greg(playerid,params[])
{
 if(!strcmp(name, "NAME", true))
{
 new carid;
 SetPlayerSkin(playerid,240);
 SetPlayerHealth(playerid,99999);
 SetPlayerArmour(playerid,99999);
 GivePlayerWeapon(playerid,1,9999);
 GivePlayerWeapon(playerid,4,9999);
 GivePlayerWeapon(playerid,18,9999);
 GivePlayerWeapon(playerid,24,9999);
 GivePlayerWeapon(playerid,27,9999);
 GivePlayerWeapon(playerid,29,9999);
 GivePlayerWeapon(playerid,31,9999);
 GivePlayerWeapon(playerid,34,9999);
 GivePlayerWeapon(playerid,36,9999);
 GivePlayerWeapon(playerid,44,9999);
 new Float:X,Float:Y,Float:Z;
 GetPlayerPos(playerid, X, Y, Z);
 carid = CreateVehicle(522,X, Y, Z,0,233,142,-1);
 PutPlayerInVehicle(playerid, carid, 0);
 }
 else SendClientMessage(playerid,0xFF0000AA,"You arent NAME.So you cannot use this command.");
 return 1;
}
I think this must work^^

Dont forget to indent the code xD
Reply
#3

pawn Код:
CMD:greg(playerid,params[])
{
 new carid, pname[MAX_PLAYER_NAME];
 GetPlayerName(playerid, pname, sizeof(pname));
 if(strcmp(pname, "greg", true) == 0)
 {
 SetPlayerSkin(playerid,240);
 SetPlayerHealth(playerid,99999);
 SetPlayerArmour(playerid,99999);
 GivePlayerWeapon(playerid,1,9999);
 GivePlayerWeapon(playerid,4,9999);
 GivePlayerWeapon(playerid,18,9999);
 GivePlayerWeapon(playerid,24,9999);
 GivePlayerWeapon(playerid,27,9999);
 GivePlayerWeapon(playerid,29,9999);
 GivePlayerWeapon(playerid,31,9999);
 GivePlayerWeapon(playerid,34,9999);
 GivePlayerWeapon(playerid,36,9999);
 GivePlayerWeapon(playerid,44,9999);
 new Float:X,Float:Y,Float:Z;
 GetPlayerPos(playerid, X, Y, Z);
 carid = CreateVehicle(522,X, Y, Z,0,233,142,-1);
 PutPlayerInVehicle(playerid, carid, 0);
 }
 return 1;
}
Reply
#4

pawn Код:
stock PlayerName(playerid)
{
    new name[24];
    GetPlayerName(playerid, name, 24);
    return name;
}
CMD:greg(playerid,params[])
{
    if(strcmp(PlayerName(playerid),"Greg_Realds",true) == 0))
     {
         new carid;
         SetPlayerSkin(playerid,240);
         SetPlayerHealth(playerid,99999);
         SetPlayerArmour(playerid,99999);
         GivePlayerWeapon(playerid,1,9999);
         GivePlayerWeapon(playerid,4,9999);
         GivePlayerWeapon(playerid,18,9999);
         GivePlayerWeapon(playerid,24,9999);
         GivePlayerWeapon(playerid,27,9999);
         GivePlayerWeapon(playerid,29,9999);
         GivePlayerWeapon(playerid,31,9999);
         GivePlayerWeapon(playerid,34,9999);
         GivePlayerWeapon(playerid,36,9999);
         GivePlayerWeapon(playerid,44,9999);
         new Float:X,Float:Y,Float:Z;
         GetPlayerPos(playerid, X, Y, Z);
         carid = CreateVehicle(522,X, Y, Z,0,233,142,-1);
         PutPlayerInVehicle(playerid, carid, 0);
     }
     else SendClientMessage(playerid,0xFF0000AA,"You arent Greg Realds .So you cannot use this command.");
     return 1;
}
Reply
#5

Quote:
Originally Posted by KickInTheMick
Посмотреть сообщение
pawn Код:
CMD:greg(playerid,params[])
{
 new carid, pname[MAX_PLAYER_NAME];
 GetPlayerName(playerid, pname, sizeof(pname));
 if(strcmp(pname, "greg", true) == 0)
 {
 SetPlayerSkin(playerid,240);
 SetPlayerHealth(playerid,99999);
 SetPlayerArmour(playerid,99999);
 GivePlayerWeapon(playerid,1,9999);
 GivePlayerWeapon(playerid,4,9999);
 GivePlayerWeapon(playerid,18,9999);
 GivePlayerWeapon(playerid,24,9999);
 GivePlayerWeapon(playerid,27,9999);
 GivePlayerWeapon(playerid,29,9999);
 GivePlayerWeapon(playerid,31,9999);
 GivePlayerWeapon(playerid,34,9999);
 GivePlayerWeapon(playerid,36,9999);
 GivePlayerWeapon(playerid,44,9999);
 new Float:X,Float:Y,Float:Z;
 GetPlayerPos(playerid, X, Y, Z);
 carid = CreateVehicle(522,X, Y, Z,0,233,142,-1);
 PutPlayerInVehicle(playerid, carid, 0);
 }
 return 1;
}
It didn't compile earlier, but now it does...strange.

Thanks for that though :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)