SA-MP Forums Archive
Problem Fast[Rep] - 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: Problem Fast[Rep] (/showthread.php?tid=321672)



Problem Fast[Rep] - Dan_Barocu - 27.02.2012

how can i create an cmd like this i type /dmv [playerid/id] and the person goes to Dmv.get it?please helpFast!Rep


Re: Problem Fast[Rep] - ArmyOps - 27.02.2012

what dmd stand for?
More information needed


Re: Problem Fast[Rep] - Dan_Barocu - 27.02.2012

or /cityhall [playerid/id] get it and it sends the player at cityhall..


Re: Problem Fast[Rep] - ArmyOps - 27.02.2012

So its teleporting? Give some coords, and il make it for u. (The location where u want to get teleported)


Re: Problem Fast[Rep] - Dan_Barocu - 27.02.2012

1221.1116,-1814.8745,16.5938 coords like /cityhall playerid then i sends him to this coords.


Re: Problem Fast[Rep] - ArmyOps - 27.02.2012

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
1221.1116,-1814.8745,16.5938 coords like /cityhall playerid then i sends him to this coords.
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/cityhall",true))
    {            
        SetPlayerPos(playerid,1221.1116,-1814.8745,16.5938);
        return 1;
    }
    return 0;
}



Re: Problem Fast[Rep] - Dan_Barocu - 27.02.2012

Quote:
Originally Posted by ArmyOps
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/cityhall",true))
    {            
        SetPlayerPos(playerid,1221.1116,-1814.8745,16.5938);
        return 1;
    }
    return 0;
}
so what happens if i type /cityhall [playerid/id]
and it send an player at the coords get it now??


Re: Problem Fast[Rep] - Dan_Barocu - 27.02.2012

anyone help please..


Re: Problem Fast[Rep] - Walsh - 27.02.2012

Quote:
Originally Posted by ArmyOps
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/cityhall",true))
    {            
        SetPlayerPos(playerid,1221.1116,-1814.8745,16.5938);
        return 1;
    }
    return 0;
}
This is wrong. He wants to send a targetid to the cityhall. Not himself.

This is using ZCMD and sscanf. You should use it. It is fast, easy, and much more practical than using a string comparer as a command processor.

pawn Код:
CMD:cityhall(playerid,params[])
{
    new targetid;
    if(!IsPlayerAdmin(playerid)) //This is an Admin-Only command.
    {
        return SendClientMessage(playerid,0xFFFFFFFF,"  You are not authorized to use that command.");
    }
    if(sscanf(params,"i",targetid))
    {
        return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /cityhall [playerid]");
    }
    if(i == INVALID_PLAYER_ID)
    {
        return SendClientMessage(playerid,0xFFFFFFFF,"Player not found.");
    }
    else
    {
        new Admin[24],string[50];
        GetPlayerName(playerid,Admin,sizeof(Admin));
        format(string,sizeof(string),"Administrator %s has teleported you to City Hall.");
        SendClientMessage(targetid,0xFFFFFFFF,string);
        SetPlayerPos(targetid,1221.1116,-1814.8745,16.5938);
        return 1;
    }
    return 1;
}
Go check out those ZCMD and sscanf tutorials man.


Re: Problem Fast[Rep] - Dan_Barocu - 27.02.2012

Quote:
Originally Posted by Walsh
Посмотреть сообщение
This is wrong. He wants to send a targetid to the cityhall. Not himself.

This is using ZCMD and sscanf. You should use it. It is fast, easy, and much more practical than using a string comparer as a command processor.

pawn Код:
CMD:cityhall(playerid,params[])
{
    new targetid;
    if(!IsPlayerAdmin(playerid)) //This is an Admin-Only command.
    {
        return SendClientMessage(playerid,0xFFFFFFFF,"  You are not authorized to use that command.");
    }
    if(sscanf(params,"i",targetid))
    {
        return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /cityhall [playerid]");
    }
    if(i == INVALID_PLAYER_ID)
    {
        return SendClientMessage(playerid,0xFFFFFFFF,"Player not found.");
    }
    else
    {
        new Admin[24],string[50];
        GetPlayerName(playerid,Admin,sizeof(Admin));
        format(string,sizeof(string),"Administrator %s has teleported you to City Hall.");
        SendClientMessage(targetid,0xFFFFFFFF,string);
        SetPlayerPos(targetid,1221.1116,-1814.8745,16.5938);
        return 1;
    }
    return 1;
}
Go check out those ZCMD and sscanf tutorials man.
Can i make it in

PHP код:
if(strcmp(cmd"/cityhall"true) == 0
??