help me to convert cmd
#1

Hello
I want to transform this code (zcmd to strcmp) please help me how to do it anyway.
PHP код:
CMD:createactor(playerid,params[]) {
    new 
actorName[24],skin;
    if(
sscanf(params,"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] ");
    new 
Float:x,Float:y,Float:z,Float:a;
    
GetPlayerPos(playerid,x,y,z);
    
GetPlayerFacingAngle(playerid,a);
    new 
animlib[32];
     new 
animname[32];
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname);
    new 
string[128];
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName);
    
SendClientMessage(playerid,COLOR_GREY,string);
    return 
true;

Reply
#2

That's going backwards really. You'd be better off converting the strcmp to zcmd.
Reply
#3

yup zcmd easy,fast.
Reply
#4

plz help me to convert zcmd to strcmp
Reply
#5

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
     if(!
strcmp(cmdtext"/createactor")) 
     {
    new 
actorName[24],skin
    if(
sscanf(params,"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] "); 
    new 
Float:x,Float:y,Float:z,Float:a
    
GetPlayerPos(playerid,x,y,z); 
    
GetPlayerFacingAngle(playerid,a); 

    new 
animlib[32]; 
     new 
animname[32]; 

    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); 

    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname); 

    new 
string[128]; 
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName); 
    
SendClientMessage(playerid,COLOR_GREY,string); 
        return 
1;
     }
     return 
0;

Reply
#6

As they said ZCMD is too much faster than strcmp, you'll notice it in the future,
anyway here is your CMD ( under OnPlayerCommandText )
PHP код:
if(strcmp(cmd"/createactor"true) == 0)
{
    new 
actorName[24],skin
    if(
sscanf(params,"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] "); 
    new 
Float:x,Float:y,Float:z,Float:a
    
GetPlayerPos(playerid,x,y,z); 
    
GetPlayerFacingAngle(playerid,a); 
    new 
animlib[32]; 
     new 
animname[32]; 
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); 
    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname); 
    new 
string[128]; 
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName); 
    
SendClientMessage(playerid,COLOR_GREY,string); 
    return 
1;

Reply
#7

Yes you are right I will have to change their code.
I'm errors when compiling the catalog!
PHP код:
error 017undefined symbol "params" 
Reply
#8

PHP код:
if(strcmp(cmd"/createactor"true) == 0)
{
    new 
actorName[24],skin
    if(
sscanf(cmd[13],"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] "); 
    new 
Float:x,Float:y,Float:z,Float:a
    
GetPlayerPos(playerid,x,y,z); 
    
GetPlayerFacingAngle(playerid,a); 
    new 
animlib[32]; 
     new 
animname[32]; 
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); 
    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname); 
    new 
string[128]; 
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName); 
    
SendClientMessage(playerid,COLOR_GREY,string); 
    return 
1;

Reply
#9

Quote:
Originally Posted by Macronix
Посмотреть сообщение
PHP код:
if(strcmp(cmd"/createactor"true) == 0)
{
    new 
actorName[24],skin
    if(
sscanf(cmd,"is[24]",skin,actorName)) return SendClientMessage(playerid,COLOR_GREY,"Usage: /createactor [skinid] [name] "); 
    new 
Float:x,Float:y,Float:z,Float:a
    
GetPlayerPos(playerid,x,y,z); 
    
GetPlayerFacingAngle(playerid,a); 
    new 
animlib[32]; 
     new 
animname[32]; 
    
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32); 
    
sql_CreateActor(actorNameskinx,y,z,aanimlibanimname); 
    new 
string[128]; 
    
format(string,sizeof(string), "New actor created. Skin ID: %i Name: %s. Type /reloadactors to reload all actors",skin,actorName); 
    
SendClientMessage(playerid,COLOR_GREY,string); 
    return 
1;

Unfortunately it did not work
Reply
#10

#Didn't read the latest reply! Sorry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)