SA-MP Forums Archive
i cannot accept his message ( sendername ) - 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: i cannot accept his message ( sendername ) (/showthread.php?tid=632117)



i cannot accept his message ( sendername ) - Jihanz - 09.04.2017

Whats wrong in this code so that I can not accept his message



this is command /service 1 (taxi)
PHP код:
CMD:service(playeridparams[])
{
    if(
TelahLogin[playerid]==0) return SCM(playerid,warna_merah,"kamu belum login");
    if(
isnull(params)) return SendClientMessage(playeridwarna_biru"Gunakan: /service [1.taxi/2.medic]");
    if(!
strcmp(params,"1",true))
    {
        new 
str[90],pID,sendername[MAX_PLAYER_NAME+12];
        
GetPlayerName(pID,sendername,sizeof(sendername));
        if(
PlayerInfo[playerid][pJobTaxi] == 1) return SendClientMessage(playerid,warna_putih,"Kamu seorang driver taxi dan tidak semestinya menggunakan command ini");
        if(
taxidriver 1) return SendClientMessage(playerid,warna_coklattua,"Sekarang tidak ada pengemudi taxi yang bertugas, tunggu beberapa saat");
        
SendClientMessage(playerid,warna_putih,"Kamu sudah memanggil taxi");
        if(
taxidriver >= 1){
        
format(str,sizeof(str),"Seorang Bernama %s memanggil taxi driver ketik '/accept taxi' untuk menerimanya",sendername);
        
SendClientMessage(PlayerInfo[pID][pJobTaxi],warna_biru,str);
        }
        
    }
    else if(!
strcmp(params,"2",true))
    {
    
    }
    return 
1;




Re: i cannot accept his message ( sendername ) - SyS - 09.04.2017

Please explain your problem well.


Re: i cannot accept his message ( sendername ) - Jihanz - 09.04.2017

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Please explain your problem well.
I'm creating a taxi system, I mean, when someone types /service taxi, the message is only appears to someone who does that instead, not for the taxi drivers on duty. How to make it appear in taxi drivers on duty?


Re: i cannot accept his message ( sendername ) - khRamin78 - 09.04.2017

see dude u have to make a loop to check who is a taxi driver which is on duty then sent them message as im seeing you are sending that massage for noone

use for(new i;i<MAX_PLAYER;i++)
{}
for looping through all players

if you need help to how to make that just tell ill make it for you and post it here


Re: i cannot accept his message ( sendername ) - khRamin78 - 09.04.2017

Quote:
Originally Posted by khRamin78
Посмотреть сообщение
see dude u have to make a loop to check who is a taxi driver which is on duty then sent them message as im seeing you are sending that massage for noone

use for(new i;i<MAX_PLAYER;i++)
{}
for looping through all players

if you need help to how to make that just tell ill make it for you and post it here
PHP код:
if(!strcmp(params,"1",true))
{
    if(
taxidriver 1) return SendClientMessage(playerid,warna_coklattua,"Sekarang tidak ada pengemudi taxi yang bertugas, tunggu beberapa saat");
    if(
PlayerInfo[playerid][pJobTaxi] == 1) return SendClientMessage(playerid,warna_putih,"Kamu seorang driver taxi dan tidak semestinya menggunakan command ini");
    new 
str[90],sendername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,sendername,sizeof(sendername));
    
SendClientMessage(playerid,warna_putih,"Kamu sudah memanggil taxi");
    
format(str,sizeof(str),"Seorang Bernama %s memanggil taxi driver ketik '/accept taxi' untuk menerimanya",sendername);
    for(new 
i;i<MAX_PLAYER;i++)
    {
        if(
PlayerInfo[i][pJobTaxi] == 1)
        {
            
SendClientMessage(i,warna_biru,str);
        }
    }




Re: i cannot accept his message ( sendername ) - Jihanz - 10.04.2017

Quote:
Originally Posted by khRamin78
Посмотреть сообщение
PHP код:
if(!strcmp(params,"1",true))
{
    if(
taxidriver 1) return SendClientMessage(playerid,warna_coklattua,"Sekarang tidak ada pengemudi taxi yang bertugas, tunggu beberapa saat");
    if(
PlayerInfo[playerid][pJobTaxi] == 1) return SendClientMessage(playerid,warna_putih,"Kamu seorang driver taxi dan tidak semestinya menggunakan command ini");
    new 
str[90],sendername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,sendername,sizeof(sendername));
    
SendClientMessage(playerid,warna_putih,"Kamu sudah memanggil taxi");
    
format(str,sizeof(str),"Seorang Bernama %s memanggil taxi driver ketik '/accept taxi' untuk menerimanya",sendername);
    for(new 
i;i<MAX_PLAYER;i++)
    {
        if(
PlayerInfo[i][pJobTaxi] == 1)
        {
            
SendClientMessage(i,warna_biru,str);
        }
    }

Awesome thanks bro rep+