SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 21/02/2011, 01:09 PM   #1
xir
Gangsta
 
Join Date: Aug 2010
Posts: 746
Reputation: 0
Default how to make this command to zcmd and sscanf?

hi everyone, i saw this command in a game mode how can I make it in zcmd and sscanf?

pawn Code:
if(strcmp(cmd,"/createclan",true) == 0)
    {
        if(PlayerInfo[playerid][pRank] > 0) return SendClientMessage(playerid,Red,"You are already in a clan !");
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp))
        {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createclan 1/2 (front or back) (tag)");
        SendClientMessage(playerid,COLOR_GREEN,"Do not include [ or ] in the tag");
        return 1;
        }
        moneys = strval(tmp);
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
        idx++;
        }
        new offset = idx;
        new result[256];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
        result[idx - offset] = cmdtext[idx];
        idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))
        {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createclan 1/2 (front or back) (tag)");
        SendClientMessage(playerid,COLOR_GREEN,"Do not include [ or ] in the tag");
        return 1;
        }
        for(new i = 0; i < sizeof(Clans); i++)
        {
            if(clan != 255)
            {
                SendClientMessage(playerid,Red,"You are in a clan !");
                return 1;
            }
            if(strmatch(Clans[i][cName],result)) return SendClientMessage(playerid,Red,"Clan name already exists !");
            if(moneys == 1)
            {
                i = lastclan;
                PlayerInfo[playerid][pClanKey] = lastclan;
                PlayerInfo[playerid][pRank] = 3;
                GetPlayerName(playerid,sendername,sizeof(sendername));
                strmid(Clans[i][clOwner], sendername, 0, strlen(sendername), 255);
                strmid(Clans[i][cName], result, 0, strlen(result), 255);
                Clans[i][Front] = 1;
                format(string,sizeof(string),"You have created the clan [%s], at the front of your name.",result);
                SendClientMessage(playerid,COLOR_GREEN,string);
                lastclan++;
                SaveClans();
                OnPlayerDataSave(playerid);
                return 1;
            }
            if(moneys == 2)
            {
                i = lastclan;
                PlayerInfo[playerid][pClanKey] = lastclan;
                PlayerInfo[playerid][pRank] = 3;
                GetPlayerName(playerid,sendername,sizeof(sendername));
                strmid(Clans[i][clOwner], sendername, 0, strlen(sendername), 255);
                strmid(Clans[i][cName], result, 0, strlen(result), 255);
                Clans[i][Back] = 1;
                format(string,sizeof(string),"You have created the clan [%s], at the back of your name.",result);
                SendClientMessage(playerid,COLOR_GREEN,string);
                lastclan++;
                SaveClans();
                OnPlayerDataSave(playerid);
                return 1;
            }
        }
        return 1;
    }
xir is offline  
Old 21/02/2011, 02:13 PM   #2
xir
Gangsta
 
Join Date: Aug 2010
Posts: 746
Reputation: 0
Default Re: how to make this command to zcmd and sscanf?

pawn Code:
new lastclan=0;
new seconds;
new Invited[MAX_PLAYERS];
new invite;
new inviter;
enum ClanSystem
{
    cName[MAX_PLAYER_NAME],
    clOwner[MAX_PLAYER_NAME],
    Front,
    Back,
    cID,
};
new Clans[100][ClanSystem];

pawn Code:
new clan = PlayerInfo[playerid][pClanKey];

Is this good enough for the rest of the code to be converted?
I deleted it before I put it here on samp forums
your right strcmp/strtok sucks

also can you please explain how you did it so i can learn it too
xir is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] How to make commands using ZCMD + SSCANF Spiral Tutorials 7 21/08/2012 01:41 AM
Goto command with sscanf, zcmd PlayerID Help Archive 5 30/07/2011 11:47 PM
need help with /pm command using zcmd & sscanf OldDirtyBastard Help Archive 3 26/01/2011 08:59 PM
How to make command ''pm'' trough zcmd [WSF]ThA_Devil Help Archive 3 31/10/2010 08:56 AM


All times are GMT. The time now is 12:10 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.