SA-MP Forums Archive
how to change a command to zcmd ? - 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: how to change a command to zcmd ? (/showthread.php?tid=634377)



how to change a command to zcmd ? - SH0x - 17.05.2017

hi
i have this command and i wanna to change it to zcmd

Код HTML:
    if(strcmp(cmd, "/drag", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        if(PINFO[playerid][pAdmin] <= 0)
        {
        SCM(playerid,COLOR_ERROR,"Error: Error: Your admin level isn't high enough to use this command");
        return 1;
        }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_YELLOW, "Syntax: /drag <PlayerID/PartOfName>");
                return 1;
            }
            new newcar = GetPlayerVehicleID(playerid);
            new playa;
            playa = ReturnUser(tmp);
            if(!newcar) { SCM(playerid,COLOR_ERROR,"You are not in a vehicle."); return 1; }
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                            PutPlayerInVehicle(playa,newcar,1);
                            GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            new sttr[256];
                            format(sttr,256,"Admin %s drags you to his/her vehicle.",sendername);
                            SCM(playa,COLOR_AdminWarn,sttr);
                            SCM(playerid,COLOR_ERROR,"Dragged.");
                    }
                }
        }
        return 1;
    }
can someone write for example ? <3


Re: how to change a command to zcmd ? - adri[4]Life - 17.05.2017

REMOVED :V


Re: how to change a command to zcmd ? - BiosMarcel - 17.05.2017

you could seriously have ******d that ...

@adrianlouise that will give errors, anyways don't post code that u didnt check


Re: how to change a command to zcmd ? - RxErT - 18.05.2017

Here you are:

PHP код:
#include <sscanf>
CMD:drag(playeridparams[])
{
        new 
name[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], id;
        
GetPlayerName(idname,sizeof(name));
        if(
IsPlayerConnected(playerid))
        {
        if(
PINFO[playerid][pAdmin] <= 0)
        {
        
SCM(playerid,COLOR_ERROR,"Error: Your admin level isn't high enough to use this command");
        return 
1;
        }
        if(
sscanf(params,"i",id))
            {
                
SendClientMessage(playeridCOLOR_YELLOW"Syntax: /drag <PlayerID>");
                return 
1;
            }
            new 
newcar GetPlayerVehicleID(playerid);
            if(!
newcar) { SCM(playerid,COLOR_ERROR,"You are not in a vehicle."); return 1; }
                if(
IsPlayerConnected(id))
                {
                    if(
id != INVALID_PLAYER_ID)
                    {
                            
PutPlayerInVehicle(id,newcar,1);
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            new 
sttr[256];
                            
format(sttr,256,"Admin %s drags you to his/her vehicle.",sendername);
                            
SCM(playa,COLOR_AdminWarn,sttr);
                            
SCM(playerid,COLOR_ERROR,"Dragged.");
                    }
                }
        }
        return 
1;

NOTE: i just added sscanf.inc include to your script to let it work carefully! so if you haven't it yet download it and include it in your script.
Hope that will work with you!


Re: how to change a command to zcmd ? - IceBilizard - 18.05.2017

why you made so long command it can be done simple as that

PHP код:
CMD:drag(playeridparams[])
{
        new 
name[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], idsttr[100];
        if(!
IsPlayerConnected(id)) return SCM(playerid0xFF0000FF"Error: Inactive userid!");
        if(
PINFO[playerid][pAdmin] <= 0) return SCM(playerid,COLOR_ERROR,"Error: Your admin level isn't high enough to use this command");
        if(
sscanf(params,"u",id)) return SendClientMessage(playeridCOLOR_YELLOW"Syntax: /drag <PlayerID>");
        if(!
IsPlayerInAnyVehicle(playerid)) return SCM(playerid,COLOR_ERROR,"You are not in a vehicle.");
        new 
newcar GetPlayerVehicleID(playerid);
        
PutPlayerInVehicle(id,newcar,1);
        
GetPlayerName(idname,sizeof(name));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
format(sttr,sizeof(sttr),"Admin %s drags you to his/her vehicle.",sendername);
        
SCM(idCOLOR_AdminWarnsttr);
        
SCM(playerid,COLOR_ERROR,"Dragged.");
        return 
1;




Re: how to change a command to zcmd ? - zedshadowzw - 18.05.2017

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
why you made so long command it can be done simple as that

PHP код:
CMD:drag(playeridparams[])
{
        new 
name[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], idsttr[100];
        if(!
IsPlayerConnected(id)) return SCM(playerid0xFF0000FF"Error: Inactive userid!");
        if(
PINFO[playerid][pAdmin] <= 0) return SCM(playerid,COLOR_ERROR,"Error: Your admin level isn't high enough to use this command");
        if(
sscanf(params,"u",id)) return SendClientMessage(playeridCOLOR_YELLOW"Syntax: /drag <PlayerID>");
        if(!
IsPlayerInAnyVehicle(playerid)) return SCM(playerid,COLOR_ERROR,"You are not in a vehicle.");
        new 
newcar GetPlayerVehicleID(playerid);
        
PutPlayerInVehicle(id,newcar,1);
        
GetPlayerName(idname,sizeof(name));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
format(sttr,sizeof(sttr),"Admin %s drags you to his/her vehicle.",sendername);
        
SCM(idCOLOR_AdminWarnsttr);
        
SCM(playerid,COLOR_ERROR,"Dragged.");
        return 
1;

I know right, I have been wondering that


Re: how to change a command to zcmd ? - SH0x - 18.05.2017

thank you all


Re: how to change a command to zcmd ? - RxErT - 18.05.2017

Quote:
Originally Posted by zedshadowzw
Посмотреть сообщение
I know right, I have been wondering that
Give me reason for saying that? it make no sense


Re: how to change a command to zcmd ? - Spoookymon - 18.05.2017

Quote:
Originally Posted by RxErT
Посмотреть сообщение
Give me reason for saying that? it make no sense
How about this:
Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
why you made so long command it can be done simple as that
Quote:
Originally Posted by zedshadowzw
Посмотреть сообщение
I know right, I have been wondering that
Good enough for ya lord ?