sscanf help = +Rep =S
#1

Hello there, I am making a command /load I have made the command and ready to test it put when I do i keep getting a message Player isn't connected. But I add a connect id Any Suggestions || Please help!

Код:
COMMAND:load(playerid, vehicleid, params[])
{
	{
		new LoadName;
		new SenderName[MAX_PLAYER_NAME];
		new PlayerName[MAX_PLAYER_NAME];
		if (!sscanf(params, "u", LoadName))
		{
			if (LoadName == INVALID_PLAYER_ID)
			{
   			SendClientMessage(playerid, COLOR_BRIGHTRED, "(INFO) You have specified an invalid player ID.");
			return 1;
			}
			else
			{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Player ID]");
			}
		}
        if(gteam[playerid] == 2)
		{
			new string[128];
			GetPlayerName(playerid, SenderName, sizeof(SenderName));
			GetPlayerName(LoadName, PlayerName, sizeof(PlayerName));
		 	PutPlayerInVehicle(LoadName, vehicleid, 3);
			format(string, sizeof(string), "(INFO) You have loaded %s into your ambulance.", LoadName);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			format(string, sizeof(string), "(INFO) You have been loaded into a ambulance by %s", SenderName);
			SendClientMessage(LoadName, COLOR_LIGHTBLUE, string);
			format(string, sizeof(string), "DISPATCH: %s has loaded %s into the ambulance.", SenderName, LoadName);
			SendFireMessage(COLOR_BRIGHTRED, string);
			TogglePlayerControllable(LoadName, 0);
			return 1;
		}
	}
	return 1;
}
Reply
#2

pawn Код:
COMMAND:load(playerid, vehicleid, params[])
{
    new LoadName;
    new SenderName[MAX_PLAYER_NAME];
    new PlayerName[MAX_PLAYER_NAME];
    if (sscanf(params, "u", LoadName)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Player ID]"),1;
    if(!IsPlayerConnected(LoadName) || LoadName == INVALIR_PLAYER_ID) return SendClientMessage(playerid, COLOR_BRIGHTRED, "(INFO) You have specified an invalid player ID."),1;
    if(gteam[playerid] == 2)
    {
        new string[128];
        GetPlayerName(playerid, SenderName, sizeof(SenderName));
        GetPlayerName(LoadName, PlayerName, sizeof(PlayerName));
        PutPlayerInVehicle(LoadName, vehicleid, 3);
        format(string, sizeof(string), "(INFO) You have loaded %s into your ambulance.", LoadName);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "(INFO) You have been loaded into a ambulance by %s", SenderName);
        SendClientMessage(LoadName, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "DISPATCH: %s has loaded %s into the ambulance.", SenderName, LoadName);
        SendFireMessage(COLOR_BRIGHTRED, string);
        TogglePlayerControllable(LoadName, 0);
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)