how to change a command to zcmd ?
#1

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
Reply
#2

REMOVED :V
Reply
#3

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

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

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!
Reply
#5

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;

Reply
#6

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
Reply
#7

thank you all
Reply
#8

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

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 ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)