need help with two things.
#1

hello i didn't script in a while and i don't know how to do it again and i have two questions:
How do i make a script that the server says: "(username) left the game" or "(username) joined the game"?

And how do i make a car spawn menu and command?
(when you spawn the car that you sit in the car immediatly and when you get out of the care that the car is gone)

PLZ!! help me if you know how i need to do it and with a little thing of the script that i know how it looks like and how i need to do it.

Look at my other thread two: http://forum.sa-mp.com/showthread.ph...96#post1287296
srry if bad English but i'm Dutch.
THNX for your help. (even if you don't know THNX for your interest XD)
Reply
#2

Add this at OnPlayerDisconnect
Код:
new discstring[128];
new sendername[MAX_PLAYER_NAME];
switch(reason)
{
case 0: format(discstring, sizeof(discstring), "* %s has left the server. (Timeout)", sendername);
case 1: format(discstring, sizeof(discstring), "* %s has left the server. (Leaving)", sendername);
case 2: format(discstring, sizeof(discstring), "* %s has left the server. (Kicked)", sendername);
}
Reply
#3

@WoodPecker
Okay thnx and when someones joining i can just change it to "* %s has joined the server. (Connected)"
Reply
#4

Quote:
Originally Posted by WoodPecker
Посмотреть сообщение
Add this at OnPlayerDisconnect
Код:
new discstring[128];
new sendername[MAX_PLAYER_NAME];
switch(reason)
{
case 0: format(discstring, sizeof(discstring), "* %s has left the server. (Timeout)", sendername);
case 1: format(discstring, sizeof(discstring), "* %s has left the server. (Leaving)", sendername);
case 2: format(discstring, sizeof(discstring), "* %s has left the server. (Kicked)", sendername);
}
I guess he were faster, but I want to mention that using 128 string is too much.

@MeNMyselv,
If you use WoodPecker's code then you need calculate the most higher string of these sentences like this, 24 as the limit of the player name + the higher string of these sentences. That would "* %s has left the server. (Timeout)" so, if you calculate it, it's 24+33=67 string value, so you need to put another one aswell so it's 68, the less you use is the better, just mentioning.

About the spawn car, there are plany filterscrips like that, just simply search them.
Reply
#5

Eliran i gaved him an example, well ye change the string to 25 or 50 , if you want to see this "%s has joined the server." you need to add it at the OnPlayerConnect
Reply
#6

okay i changed the string to 50 but when i add this lines to OnPlayerConnect it gives an error:

D:\Documents and Settings\ben\Mijn documenten\SAMP Server\gamemodes\Los Santos F4A.pwn(85) : error 017: undefined symbol "reason"
Reply
#7

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[64], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof name); // Gets the playername and stores it in name
    switch(reason)
    {
        case 0: format(string,sizeof string," ** %s left the server. Reason: Timed out",name); // ** Wesley221 left the server. Reason: Timed out
        case 1: format(string,sizeof string," ** %s left the server. Reason: Leaving",name); // ** Wesley221 left the server. Reason: Leaving
        case 2: format(string,sizeof string," ** %s left the server. Reason: Kicked/Banned",name); // ** Wesley221 left the server. Reason: Kicked/Banned
    }
    SendClientMessageToAll(ENTERYOURCOLOURHERE,string);
    return 1;
}
Edit:
pawn Код:
public OnPlayerConnect(playerid)
{
    new name[24], string[64];
    GetPlayerName(playerid, name, sizeof name);
    format(string, sizeof string, " ** %s just joined the game!", name);
    SendClientMessage(playerid, COLOR_BLUE, string);
    return 1;
}
Reply
#8

EDIT: Wesley already posted it.
Reply
#9

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
I want to mention that using 128 string is too much.
Actually it's not for sure. It's not like he's only going to make this function in OnPlayerDisconnect, he might make other bigger messages show up, which will only make the text cut short. MeNMyselv should only make it to 50 or w/e the maximum string needed for this function if he's not going to be using arrays bigger than 50.
Reply
#10

@WoodPecker
okay thnx it worked only i changed playername to playerid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)