Please Help with some misunderstanding of CMD's.
#1

Hello!

I made freeze CMD but when I am using it like /freeze <playerid>

so I freeze my brother doing, /freeze 1
But the Client Message is showing to me that MAFIA_WARS has freeze you instead of being showed to him.
I want that, Client Message should be shown to him (or that player whom I freeze).

My freeze CMD:

pawn Код:
CMD:freeze(playerid,params[])
{
    new id, targetid;
    new PlayerName[24], str_[128];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(pInfo[playerid][pAdminLevel]> 1 ) return 0;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED1,"[ ! ] USAGE: /freeze [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"[ ! ]  Invalid Player ID");
    format(str_, sizeof(str_), "[ ! ] %s has Freeze you !", PlayerName);
    SendClientMessage(targetid, COLOR_RED1, str_);
    TogglePlayerControllable(id,0);
    return 1;
}
Reply
#2

pawn Код:
CMD:freeze(playerid,params[])
{
    new id;
    new PlayerName[24], str_[128];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(pInfo[playerid][pAdminLevel]> 1 ) return 0;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED1,"[ ! ] USAGE: /freeze [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"[ ! ]  Invalid Player ID");
    format(str_, sizeof(str_), "[ ! ] %s has Freeze you !", PlayerName);
    SendClientMessage(id, COLOR_RED1, str_);
    TogglePlayerControllable(id,0);
    return 1;
}
You don't even need targetid since you never used it before, so you should put the "id" one, use that code.
Reply
#3

And Another Problem is, When I set Skin of someplayer, His running style changed and When I set back to "0", They got their running style back with normal.
Reply
#4

Quote:
Originally Posted by MAFIAWARS
Посмотреть сообщение
And Another Problem is, When I set Skin of someplayer, His running style changed and When I set back to "0", They got their running style back with normal.
Find the

pawn Код:
OnGameModeInIt
In your script and put the

pawn Код:
UsePlayerPedAnims();
EDIT: You have to put it not remove it, my bad, sorry.
Reply
#5

Quote:
Originally Posted by MAFIAWARS
Посмотреть сообщение
And Another Problem is, When I set Skin of someplayer, His running style changed and When I set back to "0", They got their running style back with normal.
Put this under OnGameModeInit if you want to use CJ's running style for all skins:

pawn Код:
UsePlayerPedAnims();
Reply
#6

Thanks All !

One more thing, How can I make /freezeall CMD to freezeall players together in one CMD?
Reply
#7

Help...
Reply
#8

pawn Код:
CMD:freezeall(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel]> 1 )
    {
        for(new i; i<MAX_PLAYERS; i++)
        {
            TogglePlayerControllable(i,0);
        }
        new p_Name[24],str[128];
        GetPlayerName(playerid,p_Name,24);
        format(str,sizeof(str),"Admin %s[%d] has freezed all players",p_Name,playerid);
        SendClientMessageToAll(-1,str);
    }
    else SendClientMessage(playerid, COLOR_BRIGHTRED, "You're not authorized to use this command.");
    return 1;
}
Reply
#9

I got an other Problem, When I am respawning Player which is ID: 1 and doing, /respawn 1
so I respawned, instead of him and the Client Message also show to me that "MAFIA_WARS has respawned you !"

That is my /respawn command:


pawn Код:
CMD:respawn(playerid, params[])
{
    new id, targetid;
    new PlayerName[24], str_[128];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED1,"[ ! ] USAGE: /respawn [playerid]");
    format(str_, sizeof(str_), "[ ! ] %s has respawned you !", PlayerName);
    SendClientMessage(targetid, COLOR_RED1, str_);
    SetPlayerPos(targetid, 1721.9911,-1608.1677,13.5469);
    SetPlayerInterior(id, 0);
    return 1;
}
But When ID:01 is respawning me, then It it working Fine.
Reply
#10

• You have created a verb and used it on the some purpose you wanted for 'id' without settling it previously - resulted in respawning first logged player(ID: 0) which was a apperantly you.
• Instead of defining the verbal 'str_' with 128 and wasting multiple cells, next time just calculate the string's and the one who respawns the player.

- So yeah, that's pretty much it. Feel free to contact me if you need furture assistance:

PHP код:
CMD:respawn(playeridparams[])
{
    new 
idtargetidPlayerName[24], str_[62];
    
GetPlayerName(playeridPlayerName24);
    if(
sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED1,"[ ! ] USAGE: /respawn [playerid]");
    
format(str_62), "[ ! ] %s has respawned you !"PlayerName);
    
SendClientMessage(idCOLOR_RED1str_);
    
SetPlayerPos(id1721.9911,-1608.1677,13.5469);
    return 
SetPlayerInterior(id0);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)